()
| 67 | } |
| 68 | |
| 69 | func (d *state) clone() *state { |
| 70 | ret := *d |
| 71 | if ret.state == spongeAbsorbing { |
| 72 | ret.buf = ret.storage[:len(ret.buf)] |
| 73 | } else { |
| 74 | ret.buf = ret.storage[d.rate-cap(d.buf) : d.rate] |
| 75 | } |
| 76 | |
| 77 | return &ret |
| 78 | } |
| 79 | |
| 80 | // permute applies the KeccakF-1600 permutation. It handles |
| 81 | // any input-output buffering. |