试图从数据库中查看我的密码,我的密码是test123,所以在我的数据库中我保存了如下内容:$2A$10$0v1jkvfl8n.wd/qbiniwqubjcaxnccnp3k.bhuxjaqbj9lyfintdu。 如何从$2A$10$0v1jkvfl8n.wd/qbiniwqubjcaxnccnp3k.bhuxjaqbj9lyfintdu再次看到我的密码。
我们可以使用nodejs或JavaScript吗?
var crypto = require("crypto");
var password = '$2a$10$0V1JkVfl8n.WD/QbInIWqubjcaxnCCnP3K.bhuxjAQbJ9LyFiNTdu';
var algorithm = "aes-192-cbc"; //algorithm to use
const key = crypto.scryptSync(password, 'salt', 24); //create key
var text = '?????????????????????????"; //text to be encrypted
const iv = Buffer.alloc(16, 0);
const cipher = crypto.createCipheriv(algorithm, key, iv);
var encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex'); // encrypted text
const decipher = crypto.createDecipheriv(algorithm, key, iv);
var decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8');
console.log(decrypted); //Output should be like test123
我不相信它是故意解密的。
加密,散列,盐分-有什么区别?
堆栈溢出问题:
如何解密HMAC?