diff options
author | 2022-12-28 22:20:15 -0800 | |
---|---|---|
committer | 2022-12-28 22:20:15 -0800 | |
commit | d726a17aca6a0b7e98ee86c193158e7860bb0834 (patch) | |
tree | e1ebdb65d532d2d655c16e2cd2e9bbc6efcf35a2 /examples | |
parent | 33e93e678984be98c3863bc4c49f6d3f3a4e7903 (diff) | |
download | bun-d726a17aca6a0b7e98ee86c193158e7860bb0834.tar.gz bun-d726a17aca6a0b7e98ee86c193158e7860bb0834.tar.zst bun-d726a17aca6a0b7e98ee86c193158e7860bb0834.zip |
Implement `Bun.RIPEMD160`
`RIPEMD160` is used by node:crypto.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/sha.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/examples/sha.js b/examples/sha.js index ab3b21164..0155aecc4 100644 --- a/examples/sha.js +++ b/examples/sha.js @@ -1,4 +1,14 @@ -import { SHA1, SHA256, SHA512, SHA384, SHA512_256, MD5, MD4, sha } from "bun"; +import { + SHA1, + SHA256, + SHA512, + SHA384, + SHA512_256, + MD5, + MD4, + RIPEMD160, + sha, +} from "bun"; const input = "Hello World"; const [first, second] = input.split(" "); @@ -16,6 +26,7 @@ log("SHA256", SHA256.hash(input, "hex")); log("SHA384", SHA384.hash(input, "hex")); log("SHA512", SHA512.hash(input, "hex")); log("SHA512_256", SHA512_256.hash(input, "hex")); +log("RIPEMD160", RIPEMD160.hash(input, "hex")); console.log(""); console.log("---- Chunked ----"); @@ -23,7 +34,7 @@ console.log(""); // You can also do updates in chunks: // const hash = new Hash(); -for (let Hash of [SHA1, SHA256, SHA384, SHA512, SHA512_256]) { +for (let Hash of [SHA1, SHA256, SHA384, SHA512, SHA512_256, RIPEMD160]) { const hash = new Hash(); hash.update(first); hash.update(" " + second); |