He wants base 256, not base 16.
It could be speeded up a little with bitwise And. "Mod 256" means discard everything except the last eight bits.
So "n Mod 256" has the same effect as "n & $FF", but uses integer division to get the result.
It could be speeded up a little with bitwise And. "Mod 256" means discard everything except the last eight bits.
So "n Mod 256" has the same effect as "n & $FF", but uses integer division to get the result.