aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/api/crypto.classes.ts
blob: 212e991a0cf1ed6d388d7b5bb3948700375a1b46 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { define } from "../scripts/class-definitions";

const names = [
  "SHA1",
  "MD5",
  "MD4",
  "SHA224",
  "SHA512",
  "SHA384",
  "SHA256",
  "SHA512_256",
];
export default names.map((name) => {
  return define({
    name: name,
    construct: true,
    finalize: true,
    klass: {
      hash: {
        fn: "hash",
        length: 2,
      },
      byteLength: {
        getter: "getByteLengthStatic",
      },
    },
    JSType: "0b11101110",
    proto: {
      digest: {
        fn: "digest",
        length: 0,
      },
      update: {
        fn: "update",
        length: 0,
      },
      byteLength: {
        getter: "getByteLength",
      },
    },
  });
});