Return to scrypt

This commit is contained in:
Tarrgon
2026-06-30 14:53:19 -04:00
parent d85279564a
commit c8492b8df9
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -5,11 +5,11 @@ import crypto from 'crypto';
export class Encrypter {
private static algorithm = 'aes-256-cbc';
private static key: string;
private static key: Buffer;
static initialize(encryptionKey: string) {
console.log(`Initializing encrypter with key: ${encryptionKey}`);
this.key = encryptionKey;
this.key = crypto.scryptSync(encryptionKey, 'salt', 32);
}
static encrypt(clearText: string): string {
@@ -38,6 +38,6 @@ export class Encrypter {
}
static hash(clearText: string): string {
return crypto.createHmac('sha256', this.key).update(clearText).digest('base64');
return crypto.createHash('sha256', this.key).update(clearText).digest('base64');
}
}