summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-11-22 11:45:12 -0500
committerrsiddharth <s@ricketyspace.net>2020-11-22 11:45:12 -0500
commit3e2a965ae1f92e429c22d2f069c4070bd335dc9d (patch)
tree136dee339dc2dba572319c96c3442257478e37ea /lib
parent8bb134cae39b65536ef1e6e8dd2f87f7a7ab2f76 (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')
-rw-r--r--lib/gf.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/gf.go b/lib/gf.go
index 52715ce..9de143b 100644
--- a/lib/gf.go
+++ b/lib/gf.go
@@ -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{