(securitybits int, n []byte, s []byte)
| 45 | var zero [maxRate]byte |
| 46 | |
| 47 | func 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 |
| 69 | func (d *state) initCShake(n []byte, s []byte) { |
no test coverage detected