The issue is just that your code is taking longer to execute than expected.
Usually, the code you upload should execute as fast as possible, and then you should do any calculations in callback functions - ideally making them execute quickly.
So if you do:
function go() {
var plain=new Int8Array(16);
var key=new Int8Array(16);
var crypt=new Int8Array(16);
var dcrypt=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
var i;
var j;
var k;
for(i=0;i<16;i++){
plain[i]=0;
key[i]=1;
dcrypt[i]=0;
}//nexti
for(k=0;k<256;k++){
plain[1]=k;
for(i=0;i<256;i++){
plain[0]=i;
crypt=AES.encrypt(plain,key,{mode:'ECB'});
for(j=0;j<16;j++)dcrypt[j]+=(crypt[j]/256);
}//nexti
}//nextk
for(j=0;j<16;j++)console.log(dcrypt[j]/256);
}
setTimeout(go, 500);
It'll work fine. Or you could just call go() from the left-hand side after upload
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
The issue is just that your code is taking longer to execute than expected.
Usually, the code you upload should execute as fast as possible, and then you should do any calculations in callback functions - ideally making them execute quickly.
So if you do:
It'll work fine. Or you could just call
go()
from the left-hand side after upload