So I have a binary number, 001000 i.e. 8.
If I do base64.b64encode(001000) I get an error.
So I do base64.b64encode(b'001000') and I get b'MDAxMDAw'.
But I need to get the base64 character in the index of the original number, 001000 or 8, which in this case would be 'I'. Or if the number was 011100 (28), then the corresponding character on the base64 table with a value of 28 would be: 'd'.
For example: here are some values in the b64 table
0 == A, 1 == B, 2 == C, 3 == D, 4 == E
So what I want to do is: First, convert the binary number to decimal (000011 == 3) . Then take that number and compare it to the base64 table, and you will see that 3 or 000011, is equal to 'D'.
Does anyone know how I could do this?
0b001000?base64.b64encode(b'0b001000')you getb'MGIwMDEwMDA='base64.b64encode(0b001000)you get an error