File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ async function generateKey(
319319 N : SCRYPT_PARAMS . N ,
320320 r : SCRYPT_PARAMS . r ,
321321 p : SCRYPT_PARAMS . p ,
322- maxmem : 128 * SCRYPT_PARAMS . N * SCRYPT_PARAMS . r * 2 ,
322+ maxmem : 128 * SCRYPT_PARAMS . N * SCRYPT_PARAMS . r * SCRYPT_PARAMS . p * 2 ,
323323 } ,
324324 ( err , key ) => {
325325 if ( err ) reject ( err )
Original file line number Diff line number Diff line change @@ -43,11 +43,11 @@ These parameters were chosen to:
4343- Maintain acceptable performance characteristics
4444
4545The actual scrypt options object includes an additional ` maxmem ` parameter set
46- to ` 128 * N * r * 2 ` , which is approximately 64MiB for our parameters. This is
47- explicitly set because Node.js has an internal default memory limit of 32 MiB.
48- By setting this parameter, we're telling Node.js that twice the estimated memory
49- (64 MiB) is allowed for this operation, ensuring optimal performance while
50- maintaining security.
46+ to ` 128 * N * r * p * 2 ` , which is approximately 64MiB for our parameters. This
47+ is explicitly set because Node.js has an internal default memory limit of 32
48+ MiB. By setting this parameter, we're telling Node.js that twice the estimated
49+ memory (64 MiB) is allowed for this operation, ensuring optimal performance
50+ while maintaining security.
5151
5252## Implementation Changes
5353
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ export function createPassword(password: string = faker.internet.password()) {
3535 N : 2 ** 14 ,
3636 r : 16 ,
3737 p : 1 ,
38- maxmem : 128 * 2 ** 14 * 16 * 2 ,
38+ maxmem : 128 * 2 ** 14 * 16 * 1 * 2 ,
3939 } )
4040 return {
4141 hash : `${ salt } :${ hash . toString ( 'hex' ) } ` ,
You can’t perform that action at this time.
0 commit comments