This repository has been archived on 2023-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
webcrypto/test/sha.ts

45 lines
1.1 KiB
TypeScript
Raw Normal View History

2019-01-25 10:43:13 +00:00
import { Convert } from "pvtsutils";
import { Crypto } from "../src";
2020-03-13 11:06:53 +00:00
import { testCrypto } from "./helper";
2019-01-25 10:43:13 +00:00
context("SHA", () => {
const crypto = new Crypto();
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",
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=="),
},
],
},
},
]);
});