Does anyone know the best way to generate a hex literal to create a bytes array lookup table in solidity? This is a simple factorial lookup table I made with a max input of 5. Does anyone know how to generate the hex literal in python for any arbitrary lookup table?
function factorial(uint256 index) public pure returns (uint256) {
return uint8 (bytes (hex"010102061878") [index]);
}
Jul 22, 2022, 3:14 PM