This repository has been archived by the owner on May 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.ts
34 lines (33 loc) · 1.47 KB
/
example.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
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
import { Sha224 } from "https://deno.land/x/[email protected]/mod/sha224.ts";
import { Sha256 } from "https://deno.land/x/[email protected]/mod/sha256.ts";
import { Sha384 } from "https://deno.land/x/[email protected]/mod/sha384.ts";
import { Sha512 } from "https://deno.land/x/[email protected]/mod/sha512.ts";
import { Sha512Trunc224 } from "https://deno.land/x/[email protected]/mod/sha512trunc224.ts";
import { Sha512Trunc256 } from "https://deno.land/x/[email protected]/mod/sha512trunc256.ts";
assertEquals(
new Sha224().hashToLowerHex(new Uint8Array()),
"d14a028c2a3a2bc9476102bb288234c415a2b01f828ea62ac5b3e42f",
);
assertEquals(
new Sha256().hashToLowerHex(new Uint8Array()),
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
);
assertEquals(
new Sha384().hashToLowerHex(new Uint8Array()),
"38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b",
);
assertEquals(
new Sha512().hashToUpperHex(new Uint8Array()),
"cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e"
.toUpperCase(),
);
assertEquals(
new Sha512Trunc224().hashToUpperHex(new Uint8Array()),
"6ed0dd02806fa89e25de060c19d3ac86cabb87d6a0ddd05c333b84f4".toUpperCase(),
);
assertEquals(
new Sha512Trunc256().hashToUpperHex(new Uint8Array()),
"c672b8d1ef56ed28ab87c3622c5114069bdd3ad7b8f9737498d0c01ecef0967a"
.toUpperCase(),
);