我已經得到了JavaScript的這個簡單的一點:JSEncrypt從而爲每個時間相同的消息和公共密鑰不同的輸出
<html>
<script type="text/javascript" src="http://cdn.rawgit.com/travist/jsencrypt/v2.1.0/bin/jsencrypt.js"></script>
<script type="text/javascript">
var message = "This is my message"
// we create a new JSEncrypt object for rsa encryption
var rsaEncrypt = new JSEncrypt();
var publicKey = "-----BEGIN PUBLIC KEY-----" +
"\nMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQK" +
"BgQCQDxDFOYJpkCaqeX4CBVNCtBjX\nMZgGMo" +
"lSs2wYrVu1ixr36KpeJcRcYhz+AnyhnUpYkgk" +
"+hEqJtDSNirU5Dk5oVYYi\ngf2uLogV5Tp/ka" +
"K49r9vtxldcHraZIgNQjcdeQUd/viKd/3DvM8" +
"naWR/mTG0nCBE\nrEQkATW/xXynJh/COQIDAQ" +
"AB\n-----END PUBLIC KEY-----"
rsaEncrypt.setPublicKey(publicKey);
var encryptedMessage = rsaEncrypt.encrypt(message);
console.log(encryptedMessage)
</script>
</html>
,我覺得應該在生產每次運行控制檯相同的輸出,但它沒有。
示例輸出:
abqE+YkCMKFWgsazbZpfGvoXLci9FL/wZLYUMR6ZFkolsvJC5MdJgq5yn+AXXy8xlKHDOry6czAaOQOTl2HXdKSfsypc8nqDU8Sx5PuEgMYjvJ/dEyfU6jVuxfH1Qmuk6aOGVHePNfDlC4kSjgp1RXToSP5NqAEi24EuMx3uulI=
OzZM03Pki3o631KOuZ5nyQKu1xXRbLHhrR0WnjE5Ns5SssoiCEwlrS+svtP0cbZaYWZJc+FlZQNFUam4iC233BKnY5Nrr5Ppj14eaBvJ4x3FR8FiLwtyEW7nTzisAS7Ys2RKPjUzmkiOCZHwIpXnUO10KVo8763+JIuDB0cDPS4=
任何人都可以解釋這種現象?
可能會有一些隨機填充。 – jfriend00