支持MD5/SHA-1/SHA-2/SHA-3/HMAC/PBKDF2/AES/TripleDES/Rabbit/RC4等算法的JavaScript库

2018/06/02 16:18
阅读数 353

https://github.com/brix/crypto-js

https://code.google.com/archive/p/crypto-js/ (代码一样,更新维护的更慢一些)

var hash = CryptoJS.MD5("Message").toString();

var encrypted = CryptoJS.DES.encrypt("Message", "Secret Passphrase", { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }); 

var decrypted = CryptoJS.DES.decrypt(encrypted, "Secret Passphrase",{ mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7 }).toString(CryptoJS.enc.Utf8);


```

CryptoJS supports the following modes:

CBC (the default)
CFB
CTR
OFB
ECB
And CryptoJS supports the following padding schemes:

Pkcs7 (the default)
Iso97971
AnsiX923
Iso10126
ZeroPadding
NoPadding

 

参考

[1] https://github.com/brix/crypto-js

展开阅读全文
加载中

作者的其它热门文章

打赏
0
0 收藏
分享
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部