WebCrypto no longer uses sequences of ArrayBuffers
[WebKit-https.git] / LayoutTests / crypto / subtle / sha-224.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test-pre.js"></script>
5 <script src="resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
10
11 <script>
12 description("Test crypto.subtle.digest.");
13
14 jsTestIsAsync = true;
15
16 Promise.fulfill(null).then(function() {
17     debug("SHA224 of []");
18     return crypto.subtle.digest('sha-224', new Uint8Array([]));
19 }).then(function(result) {
20     digest = result;
21     shouldBe("bytesToHexString(new Uint8Array(digest))", "'d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f'");
22
23     debug("SHA224 of [0x0]")
24     return crypto.subtle.digest({name: 'sha-224'}, new Uint8Array([0]));
25 }).then(function(result) {
26     digest = result;
27     shouldBe("bytesToHexString(new Uint8Array(digest))", "'fff9292b4201617bdc4d3053fce02734166a683d7d858a7f5f59b073'");
28
29     debug("SHA224 of [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]");
30     var data = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
31     return crypto.subtle.digest({name: 'sha-224'}, data);
32 }).then(function(result) {
33     digest = result;
34     shouldBe("bytesToHexString(new Uint8Array(digest))", "'767d0cdc11079ba8dca276df5c4b85507de67dce47eda4cd9196d312'");
35     finishJSTest();
36 });
37 </script>
38
39 <script src="../../resources/js-test-post.js"></script>
40 </body>
41 </html>