2012-01-20 81 views

回答

2

找到了!

 
<script type="text/javascript" src="http://crypto-js.googlecode.com/files/2.5.3-crypto-sha1-hmac-pbkdf2-blockmodes-DES.js"></script> 
<script type="text/javascript"> 

// CBC with default padding scheme (iso7816) 
var crypted = Crypto.DES.encrypt("Message", "Secret Passphrase", { mode: new Crypto.mode.CBC }); 
var plain = Crypto.DES.decrypt(crypted, "Secret Passphrase", { mode: new Crypto.mode.CBC }); 

// CBC with ansix923 padding scheme 
var crypted = Crypto.DES.encrypt("Message", "Secret Passphrase", { mode: new Crypto.mode.CBC(Crypto.pad.ansix923) }); 
var plain = Crypto.DES.decrypt(crypted, "Secret Passphrase", { mode: new Crypto.mode.CBC(Crypto.pad.ansix923) }); 

</script>