@@ -74,20 +74,25 @@ Handle<Value> x11(const Arguments& args) {
74
74
Handle <Value> scrypt (const Arguments& args) {
75
75
HandleScope scope;
76
76
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 " );
79
79
80
80
Local<Object> target = args[0 ]->ToObject ();
81
81
82
82
if (!Buffer::HasInstance (target))
83
83
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
+
85
90
char * input = Buffer::Data (target);
86
91
char output[32 ];
87
92
88
93
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);
91
96
92
97
Buffer* buff = Buffer::New (output, 32 );
93
98
return scope.Close (buff->handle_ );
@@ -117,7 +122,7 @@ Handle<Value> scryptn(const Arguments& args) {
117
122
// unsigned int N = 1 << (getNfactor(input) + 1);
118
123
unsigned int N = 1 << nFactor;
119
124
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
121
126
122
127
123
128
Buffer* buff = Buffer::New (output, 32 );
0 commit comments