【发布时间】:2019-04-28 20:22:58
【问题描述】:
我正在尝试在 Javascript (n^e mod n) 中对数组中的每个元素 e 执行计算,然后输出随后创建的新数组。我该怎么做?到目前为止,这是我想出的,但是代码不起作用。
到目前为止,这是我想通的,但代码不起作用。
function encryptText() {
var plaintext = document.getElementById('plaintext').value;
var n = letterValue(String(plaintext));
ciphertext = array()
foreach(addon_array as key => col) {
ciphertext[key] = Math.pow(col, e) % n;
}
document.getElementById("output3").innerHTML = "Encrypted text = " + ciphertext;
}
我希望得到一个修改后的整数数组(密文)作为结果。谢谢
【问题讨论】:
标签: javascript arrays rsa