| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="resources/common.js"></script> |
| </head> |
| <body> |
| <p id="description"></p> |
| <div id="console"></div> |
| |
| <script> |
| description("Test crypto.subtle.digest."); |
| |
| jsTestIsAsync = true; |
| |
| Promise.resolve(null).then(function() { |
| debug("SHA224 of []"); |
| return crypto.subtle.digest('sha-224', new Uint8Array([])); |
| }).then(function(result) { |
| digest = result; |
| shouldBe("bytesToHexString(new Uint8Array(digest))", "'d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f'"); |
| |
| debug("SHA224 of [0x0]") |
| return crypto.subtle.digest({name: 'sha-224'}, new Uint8Array([0])); |
| }).then(function(result) { |
| digest = result; |
| shouldBe("bytesToHexString(new Uint8Array(digest))", "'fff9292b4201617bdc4d3053fce02734166a683d7d858a7f5f59b073'"); |
| |
| debug("SHA224 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]"); |
| var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]); |
| return crypto.subtle.digest({name: 'sha-224'}, data); |
| }).then(function(result) { |
| digest = result; |
| shouldBe("bytesToHexString(new Uint8Array(digest))", "'767d0cdc11079ba8dca276df5c4b85507de67dce47eda4cd9196d312'"); |
| finishJSTest(); |
| }); |
| </script> |
| |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |