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
+2 -2
View File
@@ -73,7 +73,7 @@ async function main() {
class Encrypter {
static initialize(encryptionKey) {
console.log(`Initializing encrypter with key: ${encryptionKey}`);
this.key = encryptionKey;
this.key = crypto.scryptSync(encryptionKey, 'salt', 32);
}
static encrypt(clearText) {
const iv = crypto.randomBytes(16);
@@ -92,7 +92,7 @@ class Encrypter {
return decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
}
static hash(clearText) {
return crypto.createHmac('sha256', this.key).update(clearText).digest('base64');
return crypto.createHash('sha256', this.key).update(clearText).digest('base64');
}
}
Encrypter.algorithm = 'aes-256-cbc';