deno.land / std@0.157.0 / hash / _sha3 / shake.ts

نووسراو ببینە
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
43
44
45
46
47
48
49
50
51
52
53
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.// This module is browser compatible.
import { Sponge } from "./sponge.ts";import { keccakf } from "./keccakf.ts";
/** Shake128 hash */export class Shake128 extends Sponge { /** * Instantiates a new Shake128 hash * @param bitsize length of hash in bits */ constructor(bitsize: number) { if (bitsize < 8) { throw new Error("shake128: `bitsize` too small"); }
if (bitsize % 8 !== 0) { throw new Error("shake128: `bitsize` must be multiple of 8"); }
super({ bitsize: bitsize, rate: 168, dsbyte: 0x1f, permutator: keccakf, }); }}
/** * Instantiates a new Shake256 hash * @param bitsize length of hash in bits */export class Shake256 extends Sponge { constructor(bitsize: number) { if (bitsize < 8) { throw new Error("shake256: `bitsize` too small"); }
if (bitsize % 8 !== 0) { throw new Error("shake256: `bitsize` must be multiple of 8"); }
super({ bitsize: bitsize, rate: 136, dsbyte: 0x1f, permutator: keccakf, }); }}
std

Version Info

Tagged at
a year ago