-
Notifications
You must be signed in to change notification settings - Fork 26
/
sha.ts
43 lines (39 loc) · 1.14 KB
/
sha.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Convert } from "pvtsutils";
import { testCrypto } from "./utils";
context("SHA", () => {
const data = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]);
testCrypto(crypto, [
{
name: "SHA",
actions: {
digest: [
{
name: "SHA-1",
algorithm: "SHA-1",
data,
hash: Convert.FromBase64("6JrVqWMcPv3e1+Psznm00P7c4b8="),
},
{
name: "SHA-256",
algorithm: "SHA-256",
data,
hash: Convert.FromBase64("monGjExeKLjEpVZ2c9Ri//UV20YRb5kAYk0JxHT1k/s="),
},
{
name: "SHA-384",
skip: typeof module !== "undefined", // skip for nodejs
algorithm: "SHA-384",
data,
hash: Convert.FromBase64("E9WqubQC9JnxffIniWwf0soI91o5z0Kbvk+s/32Fi3z28kAh+Fcne7Hgy1nnW4rR"),
},
{
name: "SHA-512",
algorithm: "SHA-512",
data,
hash: Convert.FromBase64("OtPzaXlFDU9TNmJE7PEBD0+RIdaIgoX/FBBP1a3thdSKoXG/HjOhEmAvkrenCIsph4kBL7h7kFYyEkGhn7dOCw=="),
},
],
},
},
]);
});