我正在尝试使用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;
}
Run Code Online (Sandbox Code Playgroud)
我希望得到一个修改后的整数(密文)数组。谢谢