aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/crypto.test.js
blob: 344d935d56e05718dd39c6bb06ab2ae0e63ce123 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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");
  });
}