Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/utils/password.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Pbkdf2 from 'pbkdf2';
import crypto from 'crypto';

const WEAK_BASE_WORDS = [
'password',
Expand Down Expand Up @@ -118,14 +119,7 @@ export const isLowEntropy = (value: string) => {
};

export const generateSalt = () => {
const salt = Pbkdf2.pbkdf2Sync(
Math.random().toString(),
Math.random().toString(),
Math.floor(Math.random() * 30),
47,
).toString('hex');

return salt;
return crypto.randomBytes(47).toString('hex');
};

export const hashPassword = (password: string) => {
Expand Down
Loading