Implementing AES from scratch is easy and fun, just read the spec and implement it 1:1, until ... you encounter GCM mode and its Galois Field "weird" math. Very. Not. Fun.
https://github.com/DavidBuchanan314/aes-playground/blob/mast...
(I left comments quoting the spec as much as possible, so it should be possible to map it back onto the spec, for anyone interested)
https://en.wikipedia.org/wiki/Vancouver_Stock_Exchange#Round...
The bug caused the index to creep up to twice the real index.
Constructions such as AES-CMAC, but also recent ones such as AEGIS only require the AES round function.