sha256_test.js 371 B

1234567891011121314
  1. new sjcl.test.TestCase("SHA-256 from catameringue", function (cb) {
  2. if (!sjcl.hash.sha256) {
  3. this.unimplemented();
  4. cb && cb();
  5. return;
  6. }
  7. var i, kat=sjcl.test.vector.sha256, p=0, f=0;
  8. for (i=0; i<kat.length; i++) {
  9. var out = sjcl.hash.sha256.hash(kat[i][0]);
  10. this.require(sjcl.codec.hex.fromBits(out) == kat[i][1], i);
  11. }
  12. cb && cb();
  13. });