1
2
3
4
5 package sha3
6
7
8 func New224() *Digest {
9 return &Digest{rate: rateK448, outputLen: 28, dsbyte: dsbyteSHA3}
10 }
11
12
13 func New256() *Digest {
14 return &Digest{rate: rateK512, outputLen: 32, dsbyte: dsbyteSHA3}
15 }
16
17
18 func New384() *Digest {
19 return &Digest{rate: rateK768, outputLen: 48, dsbyte: dsbyteSHA3}
20 }
21
22
23 func New512() *Digest {
24 return &Digest{rate: rateK1024, outputLen: 64, dsbyte: dsbyteSHA3}
25 }
26
27
28
29
30
31
32
33
34 const (
35 dsbyteSHA3 = 0b00000110
36 dsbyteKeccak = 0b00000001
37 dsbyteShake = 0b00011111
38 dsbyteCShake = 0b00000100
39
40
41
42 rateK256 = (1600 - 256) / 8
43 rateK448 = (1600 - 448) / 8
44 rateK512 = (1600 - 512) / 8
45 rateK768 = (1600 - 768) / 8
46 rateK1024 = (1600 - 1024) / 8
47 )
48
49
50
51 func NewLegacyKeccak256() *Digest {
52 return &Digest{rate: rateK512, outputLen: 32, dsbyte: dsbyteKeccak}
53 }
54
55
56
57 func NewLegacyKeccak512() *Digest {
58 return &Digest{rate: rateK1024, outputLen: 64, dsbyte: dsbyteKeccak}
59 }
60
View as plain text