diff options
author | skdltmxn <supershop@naver.com> | 2020-06-17 06:12:50 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-16 17:12:50 -0400 |
commit | b3c72d1e4554b5fd58cbf3ba2fbf56275446447b (patch) | |
tree | 613f42672a715b8fa9422a86af09abec66e4fcef /std/hash/mod.ts | |
parent | b8872cd303584b28c0d6250184e4a1205bf2ad9b (diff) |
feat(std/hash): reimplement all hashes in WASM (#6292)
Diffstat (limited to 'std/hash/mod.ts')
-rw-r--r-- | std/hash/mod.ts | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/std/hash/mod.ts b/std/hash/mod.ts new file mode 100644 index 000000000..946769f03 --- /dev/null +++ b/std/hash/mod.ts @@ -0,0 +1,34 @@ +// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. + +import { Hash } from "./_wasm/hash.ts"; +import { Hasher } from "./hasher.ts"; + +export { Hasher } from "./hasher.ts"; +export type SupportedAlgorithm = + | "md2" + | "md4" + | "md5" + | "ripemd160" + | "ripemd320" + | "sha1" + | "sha224" + | "sha256" + | "sha384" + | "sha512" + | "sha3-224" + | "sha3-256" + | "sha3-384" + | "sha3-512" + | "keccak224" + | "keccak256" + | "keccak384" + | "keccak512"; + +/** + * Creates a new `Hash` instance. + * + * @param algorithm name of hash algorithm to use + */ +export function createHash(algorithm: SupportedAlgorithm): Hasher { + return new Hash(algorithm as string); +} |