MCPcopy Create free account
hub / github.com/chain/txvm / newCShake

Function newCShake

crypto/sha3/cshake.go:47–66  ·  view source on GitHub ↗
(securitybits int, n []byte, s []byte)

Source from the content-addressed store, hash-verified

45var zero [maxRate]byte
46
47func newCShake(securitybits int, n []byte, s []byte) (d *state) {
48 if len(n) == 0 && len(s) == 0 {
49 if securitybits == 128 {
50 return &state{rate: 168, dsbyte: 0x1f} // regular SHAKE-128
51 } else if securitybits == 256 {
52 return &state{rate: 136, dsbyte: 0x1f} // regular SHAKE-256
53 } else {
54 panic("invalid security level for cSHAKE")
55 }
56 }
57 if securitybits == 128 {
58 d = &state{rate: 168, dsbyte: 0x04}
59 } else if securitybits == 256 {
60 d = &state{rate: 136, dsbyte: 0x04}
61 } else {
62 panic("invalid security level for cSHAKE")
63 }
64 d.initCShake(n, s)
65 return d
66}
67
68// The initialization of cSHAKE
69func (d *state) initCShake(n []byte, s []byte) {

Callers 5

newKMACFunction · 0.85
newTupleHashFunction · 0.85
newTupleHasherFunction · 0.85
NewCShake128Function · 0.85
NewCShake256Function · 0.85

Calls 1

initCShakeMethod · 0.80

Tested by

no test coverage detected