Skip to content

Commit 2be90f2

Browse files
committed
Change to use one scrypt_N_R algorithm
1 parent cf57a3f commit 2be90f2

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

multihashing.cc

+11-6
Original file line numberDiff line numberDiff line change
@@ -74,20 +74,25 @@ Handle<Value> x11(const Arguments& args) {
7474
Handle<Value> scrypt(const Arguments& args) {
7575
HandleScope scope;
7676

77-
if (args.Length() < 1)
78-
return except("You must provide one argument.");
77+
if (args.Length() < 3)
78+
return except("You must provide buffer to hash, N value, and R value");
7979

8080
Local<Object> target = args[0]->ToObject();
8181

8282
if(!Buffer::HasInstance(target))
8383
return except("Argument should be a buffer object.");
84-
84+
85+
Local<Number> numn = args[1]->ToNumber();
86+
unsigned int nValue = numn->Value();
87+
Local<Number> numr = args[2]->ToNumber();
88+
unsigned int rValue = numr->Value();
89+
8590
char * input = Buffer::Data(target);
8691
char output[32];
8792

8893
uint32_t input_len = Buffer::Length(target);
89-
90-
scrypt_1024_1_1_256(input, output, input_len);
94+
95+
scrypt_N_R_1_256(input, output, nValue, rValue, input_len);
9196

9297
Buffer* buff = Buffer::New(output, 32);
9398
return scope.Close(buff->handle_);
@@ -117,7 +122,7 @@ Handle<Value> scryptn(const Arguments& args) {
117122
//unsigned int N = 1 << (getNfactor(input) + 1);
118123
unsigned int N = 1 << nFactor;
119124

120-
scrypt_N_1_1_256(input, output, N, input_len);
125+
scrypt_N_R_1_256(input, output, N, 1, input_len); //hardcode for now to R=1 for now
121126

122127

123128
Buffer* buff = Buffer::New(output, 32);

0 commit comments

Comments
 (0)