diff options
author | 2022-04-12 22:59:25 -0700 | |
---|---|---|
committer | 2022-04-12 22:59:52 -0700 | |
commit | f6d73cb06ec5fe217a4d2d03808f68ecbc2d3461 (patch) | |
tree | 38ad0f487fe9a46fb4a1179967b8aee9c0510b06 /integration/bunjs-only-snippets | |
parent | b3522b2febaae5caf218a264fc5277974be8d57b (diff) | |
download | bun-f6d73cb06ec5fe217a4d2d03808f68ecbc2d3461.tar.gz bun-f6d73cb06ec5fe217a4d2d03808f68ecbc2d3461.tar.zst bun-f6d73cb06ec5fe217a4d2d03808f68ecbc2d3461.zip |
[bun.js] Implement Bun.sha1, Bun.sha256, Bun.sha384, Bun.sha512, Bun.sha512_384
Diffstat (limited to 'integration/bunjs-only-snippets')
-rw-r--r-- | integration/bunjs-only-snippets/crypto.test.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/crypto.test.js b/integration/bunjs-only-snippets/crypto.test.js new file mode 100644 index 000000000..344d935d5 --- /dev/null +++ b/integration/bunjs-only-snippets/crypto.test.js @@ -0,0 +1,28 @@ +import { it, expect } from "bun:test"; + +for (let Hasher of [ + Bun.SHA1, + Bun.SHA256, + Bun.SHA384, + Bun.SHA512, + Bun.SHA512_256, +]) { + it(`${Hasher.name} instance`, () => { + var buf = new Uint8Array(256); + const result = new Hasher(); + result.update("hello world"); + result.final(buf); + }); +} + +for (let HashFn of [ + Bun.sha1, + Bun.sha256, + Bun.sha384, + Bun.sha512, + Bun.sha512_256, +]) { + it(`${HashFn.name} instance`, () => { + HashFn("hello world"); + }); +} |