Skip to content

Commit 2cef7cc

Browse files
Add vipstar to test vectors and source code
1 parent 7abef3a commit 2cef7cc

File tree

13 files changed

+638
-363
lines changed

13 files changed

+638
-363
lines changed

.vscode/settings.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@
44
"stdlib.h": "c",
55
"errno.h": "c",
66
"functional": "cpp",
7-
"lyra2.h": "c"
7+
"lyra2.h": "c",
8+
"array": "c",
9+
"string": "c",
10+
"string_view": "c",
11+
"sph_sha2.h": "c",
12+
"groestl.h": "c",
13+
"skein.h": "c",
14+
"sph_groestl.h": "c",
15+
"stdint.h": "c",
16+
"stdio.h": "c",
17+
"sph_skein.h": "c",
18+
"vipstar.h": "c",
19+
"sysendian.h": "c",
20+
"sph_types.h": "c",
21+
"string.h": "c",
22+
"inttypes.h": "c"
823
}
924
}

binding.gyp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"src/skunk.c",
4242
"src/skydoge.c",
4343
"src/tribus.c",
44+
"src/vipstar.c",
4445
"src/whirlpoolx.c",
4546
"src/x11.c",
4647
"src/x13.c",

package-lock.json

Lines changed: 175 additions & 349 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/crypto/yespower/yespower-opt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#include <stdlib.h>
9595
#include <string.h>
9696

97-
#include "../sha256.h"
97+
#include "sha256.h"
9898
#include "sysendian.h"
9999

100100
#include "yespower.h"

src/multihashing.cc

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,15 @@ extern "C"
3636
#include "scryptjane.h"
3737
#include "scryptn.h"
3838
#include "sha1.h"
39+
#include "sha256.h"
3940
#include "sha256d.h"
4041
#include "shavite3.h"
4142
#include "skein.h"
4243
#include "skunk.h"
4344
#include "skydoge.h"
4445
#include "tribus.h"
45-
#include "crypto/sponge.h"
46+
#include "sponge.h"
47+
#include "vipstar.h"
4648
#include "whirlpoolx.h"
4749
#include "x11.h"
4850
#include "x13.h"
@@ -53,8 +55,8 @@ extern "C"
5355
#include "x25x.h"
5456
#include "xevan.h"
5557
#include "zr5.h"
56-
#include "crypto/argon2/argon2.h"
57-
#include "crypto/yespower/yespower.h"
58+
#include "argon2/argon2.h"
59+
#include "yespower/yespower.h"
5860
}
5961

6062
#include "kawpow.hpp"
@@ -459,22 +461,22 @@ DECLARE_FUNC(odo)
459461
{
460462
if (info.Length() < 2)
461463
RETURN_EXCEPT("You must provide buffer to hash and key value");
462-
464+
463465
Local<Object> target = Nan::To<Object>(info[0]).ToLocalChecked();
464466

465-
if (!Buffer::HasInstance(target))
466-
RETURN_EXCEPT("Argument should be a buffer object.");
467+
if (!Buffer::HasInstance(target))
468+
RETURN_EXCEPT("Argument should be a buffer object.");
467469

468-
unsigned int keyValue = Nan::To<uint32_t>(info[1]).ToChecked();
470+
unsigned int keyValue = Nan::To<uint32_t>(info[1]).ToChecked();
469471

470-
char* input = Buffer::Data(target);
471-
char output[32];
472+
char *input = Buffer::Data(target);
473+
char output[32];
472474

473-
uint32_t input_len = Buffer::Length(target);
475+
uint32_t input_len = Buffer::Length(target);
474476

475-
odo_hash(input, output, input_len, keyValue);
477+
odo_hash(input, output, input_len, keyValue);
476478

477-
SET_BUFFER_RETURN(output, 32);
479+
SET_BUFFER_RETURN(output, 32);
478480
}
479481

480482
DECLARE_FUNC(yespower_0_5_R8G)
@@ -543,6 +545,26 @@ DECLARE_FUNC(kawpow)
543545
SET_BUFFER_RETURN(output, 64);
544546
}
545547

548+
DECLARE_FUNC(vipstar)
549+
{
550+
if (info.Length() < 1)
551+
RETURN_EXCEPT("You must provide one argument.");
552+
553+
Local<Object> target = Nan::To<Object>(info[0]).ToLocalChecked();
554+
555+
if (!Buffer::HasInstance(target))
556+
RETURN_EXCEPT("Argument should be a buffer object.");
557+
558+
uint32_t input[32];
559+
uint32_t output[32];
560+
561+
std::memcpy(input, Buffer::Data(target), sizeof(input));
562+
563+
vipstar_hash(output, input);
564+
565+
SET_BUFFER_RETURN(reinterpret_cast<char*>(output), sizeof(output));
566+
}
567+
546568
NAN_MODULE_INIT(init)
547569
{
548570
NAN_EXPORT(target, allium);
@@ -592,6 +614,7 @@ NAN_MODULE_INIT(init)
592614
NAN_EXPORT(target, skunk);
593615
NAN_EXPORT(target, skydoge);
594616
NAN_EXPORT(target, tribus);
617+
NAN_EXPORT(target, vipstar);
595618
NAN_EXPORT(target, whirlpoolx);
596619
NAN_EXPORT(target, x11);
597620
NAN_EXPORT(target, x13);

0 commit comments

Comments
 (0)