Skip to content
This repository has been archived by the owner on Aug 1, 2023. It is now read-only.

Commit

Permalink
fix: alter argon2 config, use more memory, closes #363
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 22, 2020
1 parent 4bd2c9a commit d70ea3f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 52 deletions.
56 changes: 5 additions & 51 deletions app/crypto/key-generation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,57 +14,11 @@ describe(deriveKey.name, () => {
const salt = '$2a$12$BwnByfKrfRbpxsazN712T.';
const pass = 'f255cadb0af84854819c63f26c53e1a9';
const { derivedKeyHash } = await deriveKey({ salt, pass });
const expectedResultArray = [
94,
0,
166,
167,
20,
189,
146,
233,
48,
163,
248,
178,
48,
11,
140,
87,
82,
126,
73,
82,
237,
166,
232,
173,
90,
192,
67,
200,
149,
147,
30,
223,
60,
15,
133,
99,
89,
142,
223,
116,
131,
24,
169,
157,
157,
245,
159,
140,
];
expect(derivedKeyHash).toEqual(Uint8Array.from(expectedResultArray));
const hash = Buffer.from(derivedKeyHash).toString('hex');
console.log(hash);
expect(hash).toEqual(
'd941c6ec3f04fa67c68b497169986588436b1697aa6b3a93218152658e5c494d2e3da9ea93522f0e4cb14b414b57b463'
);
});
});

Expand Down
3 changes: 2 additions & 1 deletion app/crypto/key-generation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export async function deriveKey({ pass, salt }: { pass: string; salt: string })
pass,
salt,
hashLen: 48,
time: 400,
time: 44,
mem: 1024 * 32,
type: ArgonType.Argon2id,
});
return { derivedKeyHash: result.hash };
Expand Down

0 comments on commit d70ea3f

Please sign in to comment.