diff options
author | rsiddharth <s@ricketyspace.net> | 2020-11-22 11:45:12 -0500 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-11-22 11:45:12 -0500 |
commit | 3e2a965ae1f92e429c22d2f069c4070bd335dc9d (patch) | |
tree | 136dee339dc2dba572319c96c3442257478e37ea /lib/gf.go | |
parent | 8bb134cae39b65536ef1e6e8dd2f87f7a7ab2f76 (diff) |
lib: gf: fix GFMultiply
The logXPlusOneOf[a] + logXPlusOneOf[b] addition can go over 255, so
make it a uint16 addition.
Diffstat (limited to 'lib/gf.go')
-rw-r--r-- | lib/gf.go | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -11,11 +11,11 @@ func GFMultiply(a, b byte) byte { return 0x00 } - ans := logXPlusOneOf[a] + logXPlusOneOf[b] + ans := uint16(logXPlusOneOf[a]) + uint16(logXPlusOneOf[b]) if ans >= 255 { ans -= 255 } - return xPlusOneToThe[ans] + return xPlusOneToThe[byte(ans)] } var xPlusOneToThe map[byte]byte = map[byte]byte{ |