blob: 7f164647b211c2a650ec317733d04640c220ada6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
new sjcl.test.TestCase("AES official known-answer tests", function (cb) {
if (!sjcl.cipher.aes) {
this.unimplemented();
cb && cb();
return;
}
var i, kat = sjcl.test.vector.aes, tv, len, aes;
for (i=0; i<kat.length; i++) {
tv = kat[i];
len = 32 * tv.key.length;
aes = new sjcl.cipher.aes(tv.key);
this.require(sjcl.bitArray.equal(aes.encrypt(tv.pt), tv.ct), "encrypt "+len+" #"+i);
this.require(sjcl.bitArray.equal(aes.decrypt(tv.ct), tv.pt), "decrypt "+len+" #"+i);
}
cb && cb();
});
|