Skip to content

Commit

Permalink
Merge pull request #16 from ROZ-MOFUMOFU-ME/dev
Browse files Browse the repository at this point in the history
Add vipstar to test vectors and source code
  • Loading branch information
ROZ-MOFUMOFU-ME authored Nov 10, 2024
2 parents 7abef3a + 2cef7cc commit 896dba6
Show file tree
Hide file tree
Showing 13 changed files with 638 additions and 363 deletions.
17 changes: 16 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
"stdlib.h": "c",
"errno.h": "c",
"functional": "cpp",
"lyra2.h": "c"
"lyra2.h": "c",
"array": "c",
"string": "c",
"string_view": "c",
"sph_sha2.h": "c",
"groestl.h": "c",
"skein.h": "c",
"sph_groestl.h": "c",
"stdint.h": "c",
"stdio.h": "c",
"sph_skein.h": "c",
"vipstar.h": "c",
"sysendian.h": "c",
"sph_types.h": "c",
"string.h": "c",
"inttypes.h": "c"
}
}
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"src/skunk.c",
"src/skydoge.c",
"src/tribus.c",
"src/vipstar.c",
"src/whirlpoolx.c",
"src/x11.c",
"src/x13.c",
Expand Down
524 changes: 175 additions & 349 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/crypto/yespower/yespower-opt.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
#include <stdlib.h>
#include <string.h>

#include "../sha256.h"
#include "sha256.h"
#include "sysendian.h"

#include "yespower.h"
Expand Down
47 changes: 35 additions & 12 deletions src/multihashing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ extern "C"
#include "scryptjane.h"
#include "scryptn.h"
#include "sha1.h"
#include "sha256.h"
#include "sha256d.h"
#include "shavite3.h"
#include "skein.h"
#include "skunk.h"
#include "skydoge.h"
#include "tribus.h"
#include "crypto/sponge.h"
#include "sponge.h"
#include "vipstar.h"
#include "whirlpoolx.h"
#include "x11.h"
#include "x13.h"
Expand All @@ -53,8 +55,8 @@ extern "C"
#include "x25x.h"
#include "xevan.h"
#include "zr5.h"
#include "crypto/argon2/argon2.h"
#include "crypto/yespower/yespower.h"
#include "argon2/argon2.h"
#include "yespower/yespower.h"
}

#include "kawpow.hpp"
Expand Down Expand Up @@ -459,22 +461,22 @@ DECLARE_FUNC(odo)
{
if (info.Length() < 2)
RETURN_EXCEPT("You must provide buffer to hash and key value");

Local<Object> target = Nan::To<Object>(info[0]).ToLocalChecked();

if (!Buffer::HasInstance(target))
RETURN_EXCEPT("Argument should be a buffer object.");
if (!Buffer::HasInstance(target))
RETURN_EXCEPT("Argument should be a buffer object.");

unsigned int keyValue = Nan::To<uint32_t>(info[1]).ToChecked();
unsigned int keyValue = Nan::To<uint32_t>(info[1]).ToChecked();

char* input = Buffer::Data(target);
char output[32];
char *input = Buffer::Data(target);
char output[32];

uint32_t input_len = Buffer::Length(target);
uint32_t input_len = Buffer::Length(target);

odo_hash(input, output, input_len, keyValue);
odo_hash(input, output, input_len, keyValue);

SET_BUFFER_RETURN(output, 32);
SET_BUFFER_RETURN(output, 32);
}

DECLARE_FUNC(yespower_0_5_R8G)
Expand Down Expand Up @@ -543,6 +545,26 @@ DECLARE_FUNC(kawpow)
SET_BUFFER_RETURN(output, 64);
}

DECLARE_FUNC(vipstar)
{
if (info.Length() < 1)
RETURN_EXCEPT("You must provide one argument.");

Local<Object> target = Nan::To<Object>(info[0]).ToLocalChecked();

if (!Buffer::HasInstance(target))
RETURN_EXCEPT("Argument should be a buffer object.");

uint32_t input[32];
uint32_t output[32];

std::memcpy(input, Buffer::Data(target), sizeof(input));

vipstar_hash(output, input);

SET_BUFFER_RETURN(reinterpret_cast<char*>(output), sizeof(output));
}

NAN_MODULE_INIT(init)
{
NAN_EXPORT(target, allium);
Expand Down Expand Up @@ -592,6 +614,7 @@ NAN_MODULE_INIT(init)
NAN_EXPORT(target, skunk);
NAN_EXPORT(target, skydoge);
NAN_EXPORT(target, tribus);
NAN_EXPORT(target, vipstar);
NAN_EXPORT(target, whirlpoolx);
NAN_EXPORT(target, x11);
NAN_EXPORT(target, x13);
Expand Down
Loading

0 comments on commit 896dba6

Please sign in to comment.