Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / crypto / subtle / sha / digest.html
blobb142991c9cc736d708b7433516d1ae49f4700ceb
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 <script src="../resources/common.js"></script>
6 </head>
7 <body>
8 <p id="description"></p>
9 <div id="console"></div>
11 <script>
12 description("Tests the digest() operation for SHA-*");
14 jsTestIsAsync = true;
16 // These SHA-* test vectors were taking from:
17 // http://csrc.nist.gov/groups/STM/cavp/documents/shs/shabytetestvectors.zip
19 // This is not intended to be an exhaustive test, but rather give basic
20 // confidence that things work.
22 // Both inputs and outputs are written as a hex-encoded string.
23 kDigestTestVectors = [
25 algorithm: "SHA-1",
26 input: "",
27 output: "da39a3ee5e6b4b0d3255bfef95601890afd80709"
30 algorithm: "SHA-256",
31 input: "",
32 output: "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
35 algorithm: "SHA-384",
36 input: "",
37 output: "38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b"
40 algorithm: "SHA-512",
41 input: "",
42 output: "cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
45 algorithm: "SHA-1",
46 input: "00",
47 output: "5ba93c9db0cff93f52b521d7420e43f6eda2784f"
50 algorithm: "SHA-256",
51 input: "00",
52 output: "6e340b9cffb37a989ca544e6bb780a2c78901d3fb33738768511a30617afa01d"
55 algorithm: "SHA-384",
56 input: "00",
57 output: "bec021b4f368e3069134e012c2b4307083d3a9bdd206e24e5f0d86e13d6636655933ec2b413465966817a9c208a11717"
60 algorithm: "SHA-512",
61 input: "00",
62 output: "b8244d028981d693af7b456af8efa4cad63d282e19ff14942c246e50d9351d22704a802a71c3580b6370de4ceb293c324a8423342557d4e5c38438f0e36910ee"
65 algorithm: "SHA-1",
66 input: "000102030405",
67 output: "868460d98d09d8bbb93d7b6cdd15cc7fbec676b9"
70 algorithm: "SHA-256",
71 input: "000102030405",
72 output: "17e88db187afd62c16e5debf3e6527cd006bc012bc90b51a810cd80c2d511f43"
75 algorithm: "SHA-384",
76 input: "000102030405",
77 output: "79f4738706fce9650ac60266675c3cd07298b09923850d525604d040e6e448adc7dc22780d7e1b95bfeaa86a678e4552"
80 algorithm: "SHA-512",
81 input: "000102030405",
82 output: "2f3831bccc94cf061bcfa5f8c23c1429d26e3bc6b76edad93d9025cb91c903af6cf9c935dc37193c04c2c66e7d9de17c358284418218afea2160147aaa912f4c"
86 function runTest(testCase)
88 return crypto.subtle.digest({name: testCase.algorithm}, hexStringToUint8Array(testCase.input)).then(function(result) {
89 var testDescription = testCase.algorithm + " of [" + testCase.input + "]";
90 bytesShouldMatchHexString(testDescription, testCase.output, result);
91 });
94 var lastPromise = Promise.resolve(null);
96 kDigestTestVectors.forEach(function(test) {
97 lastPromise = lastPromise.then(runTest.bind(null, test));
98 });
100 lastPromise.then(finishJSTest, failAndFinishJSTest);
102 </script>
104 </body>
105 </html>