Skip to content

Commit 3ecb278

Browse files
committed
fake salt is removed
1 parent 88d84ee commit 3ecb278

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

examples/wallet/app/utils/decrypt.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,9 @@ import aesjs from 'aes-js';
33
import blakejs from 'blakejs';
44

55
const blake2b = data => blakejs.blake2b(data, null, 32);
6-
const SECRET = 'wallet_demo#';
7-
const AES_SECRET = ':aes_secret#';
86

97
export function aesEncrypt(unlockWalletPassword: string, text: string): string {
10-
const aesPasswordText = unlockWalletPassword
11-
.concat(SECRET)
12-
.concat(AES_SECRET);
13-
const aesKey = blake2b(aesPasswordText);
8+
const aesKey = blake2b(unlockWalletPassword);
149
const aesCtr = new aesjs.ModeOfOperation.ctr(aesKey, new aesjs.Counter(5));
1510
const encryptedBytes = aesCtr.encrypt(aesjs.utils.utf8.toBytes(text));
1611
const encryptedHex = aesjs.utils.hex.fromBytes(encryptedBytes);
@@ -21,10 +16,7 @@ export function aesDecrypt(
2116
unlockWalletPassword: string,
2217
encryptedHex: string
2318
): string {
24-
const aesPasswordText = unlockWalletPassword
25-
.concat(SECRET)
26-
.concat(AES_SECRET);
27-
const aesKey = blake2b(aesPasswordText);
19+
const aesKey = blake2b(unlockWalletPassword);
2820
const aesCtr = new aesjs.ModeOfOperation.ctr(aesKey, new aesjs.Counter(5));
2921
const decryptedBytes = aesCtr.decrypt(aesjs.utils.hex.toBytes(encryptedHex));
3022
const decryptedText = aesjs.utils.utf8.fromBytes(decryptedBytes);

0 commit comments

Comments
 (0)