@@ -217,15 +217,15 @@ smix(uint8_t * B, size_t r, uint64_t N, uint32_t * V, uint32_t * XY)
217
217
/* cpu and memory intensive function to transform a 80 byte buffer into a 32 byte output
218
218
scratchpad size needs to be at least 63 + (128 * r * p) + (256 * r + 64) + (128 * r * N) bytes
219
219
*/
220
- void scrypt_N_1_1_256_sp (const char * input , char * output , char * scratchpad , uint32_t N , uint32_t len )
220
+ void scrypt_N_R_1_256_sp (const char * input , char * output , char * scratchpad , uint32_t N , uint32_t R , uint32_t len )
221
221
{
222
222
uint8_t * B ;
223
223
uint32_t * V ;
224
224
uint32_t * XY ;
225
225
uint32_t i ;
226
226
227
227
//const uint32_t N = 1024;
228
- const uint32_t r = 1 ;
228
+ uint32_t r = R ;
229
229
const uint32_t p = 1 ;
230
230
231
231
B = (uint8_t * )(((uintptr_t )(scratchpad ) + 63 ) & ~ (uintptr_t )(63 ));
@@ -245,14 +245,14 @@ void scrypt_N_1_1_256_sp(const char* input, char* output, char* scratchpad, uint
245
245
PBKDF2_SHA256 ((const uint8_t * )input , len , B , p * 128 * r , 1 , (uint8_t * )output , 32 );
246
246
}
247
247
248
- void scrypt_N_1_1_256 (const char * input , char * output , uint32_t N , uint32_t len )
248
+ void scrypt_N_R_1_256 (const char * input , char * output , uint32_t N , uint32_t R , uint32_t len )
249
249
{
250
250
//char scratchpad[131583];
251
251
char * scratchpad ;
252
252
253
253
// align on 4 byte boundary
254
- scratchpad = (char * )malloc (128 * N + 512 );
255
- scrypt_N_1_1_256_sp (input , output , scratchpad , N , len );
254
+ scratchpad = (char * )malloc (128 * N * R + ( 128 * R ) + ( 256 * R ) + 64 + 64 );
255
+ scrypt_N_R_1_256_sp (input , output , scratchpad , N , R , len );
256
256
free (scratchpad );
257
257
}
258
258
0 commit comments