[英]How to decrypt password from JavaScript CryptoJS.AES.encrypt()
I have the following javascript code CryptoJS to encrypt the variable n
:我有以下 javascript 代码 CryptoJS 来加密变量
n
:
var l;
var n="190.207.78.120";
return l=D.enc.Base64.parse(btoa("AD7552C821266C8255348F726CAB9589")),D.AES.encrypt(n,l,{mode:D.mode.ECB,padding:D.pad.Pkcs7}).toString();
Output: Output:
IV9Ada02dMtXNr8zDfZDUA==
IV9Ada02dMtXNr8zDfZDUA==
The variable l
is my password but when I try to display it with console.log(l)
it is an object:变量
l
是我的密码,但是当我尝试使用console.log(l)
显示它时,它是一个 object:
sigBytes:32, words: [1094989621, 892486456, 842084918, 910374962, 892678964, 944125746, 910377282, 959789113]
sigBytes:32,字:[1094989621、892486456、842084918、910374962、892678964、944125746、910377282、959789113]
In the same way I can decrypt with the following code:以同样的方式,我可以使用以下代码解密:
var l;
var n="IV9Ada02dMtXNr8zDfZDUA==";
return l=D.enc.Base64.parse(btoa("AD7552C821266C8255348F726CAB9589")),D.AES.decrypt(n,l,{mode:D.mode.ECB,padding:D.pad.Pkcs7}).toString(D.enc.Utf8);
Output: Output:
190.207.78.120
190.207.78.120
How can I extract the password with which the variable n
is encrypted or decrypted?如何提取用于加密或解密变量
n
的密码?
You can't.你不能。 You didn't encrypt the password, but the variable
n
, the password is used to encrypt/decrypt, but is not encrypted itself.您没有加密密码,但变量
n
,密码用于加密/解密,但本身没有加密。
UPDATE: If by "decrypting the password" you mean to simply display the integer array you got there as a string, that's a different issue and very much depends on what you want the result to look like (for example a HEX string or a ASCII string).更新:如果通过“解密密码”你的意思是简单地将你到达那里的 integer 数组显示为一个字符串,这是一个不同的问题,很大程度上取决于你希望结果看起来像什么(例如 HEX 字符串或 ASCII细绳)。
(Possible duplicate of Word Array to String ) ( Word Array 到 String的可能重复项)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.