From f6d73cb06ec5fe217a4d2d03808f68ecbc2d3461 Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Tue, 12 Apr 2022 22:59:25 -0700 Subject: [bun.js] Implement Bun.sha1, Bun.sha256, Bun.sha384, Bun.sha512, Bun.sha512_384 --- integration/bunjs-only-snippets/crypto.test.js | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 integration/bunjs-only-snippets/crypto.test.js (limited to 'integration/bunjs-only-snippets/crypto.test.js') 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"); + }); +} -- cgit v1.2.3