mirror of
https://gogs.blitter.com/RLabs/cryptmt
synced 2024-08-14 19:26:42 +00:00
renamed yield8() to yield()
This commit is contained in:
parent
f3e54a9d98
commit
269c74fe4a
1 changed files with 3 additions and 3 deletions
|
@ -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()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue