renamed yield8() to yield()

This commit is contained in:
Russ Magee 2019-09-24 21:25:37 -07:00
parent f3e54a9d98
commit 269c74fe4a

View file

@ -20,7 +20,7 @@ type Cipher struct {
m *mtwist.MT19937_64 m *mtwist.MT19937_64
} }
func (c *Cipher) yield8() (r byte) { func (c *Cipher) yield() (r byte) {
c.accum = c.accum * (c.m.Int63() | 1) c.accum = c.accum * (c.m.Int63() | 1)
r = byte(c.accum>>56) & 0xFF r = byte(c.accum>>56) & 0xFF
return return
@ -34,7 +34,7 @@ func NewCipher(key []byte) (c *Cipher) {
c.accum = 1 c.accum = 1
// from paper, discard first 64 bytes of output // from paper, discard first 64 bytes of output
for idx := 0; idx < 64; idx++ { for idx := 0; idx < 64; idx++ {
_ = c.yield8() _ = c.yield()
} }
return c return c
} }
@ -55,6 +55,6 @@ func (c *Cipher) XORKeyStream(dst, src []byte) {
} }
for i, b := range src { for i, b := range src {
dst[i] = b ^ c.yield8() dst[i] = b ^ c.yield()
} }
} }