More then you ever wanted to know about bits bytes and Hex.
- Bytes32 = uint256
- 1 bit = can represent 2 numbers – 0 or 1 or 2**1
- 1 byte = 8 bits and can represent 2**8 =256
- To convert a byte to a number do the following
- 10011101 = 2**7 + 2**4 + 2**3 + 2**2 + 2**0 (the power of is a representation of the position of the bit 7,6,5,4,3,2,1,0)
- =157
- Hexadecimal = 0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F
- A character of hex can be 0-16 which is the same as 2**4
- 0x denotes hexadecimal. So 0x3EA = 3 * 16**2 + 14*16**1 + 10*16**0
- =1002
- 1 byte = 8 bits = 2 hex
- 1 byte = 8 bits which is the same as 2*4 bit which is the same as 2 hex