

I will be using Visual Studio Code for this tutorial. You can download either Pycharm or Visual Studio Code

You simply apply the mask 255 to the integer to obtain the lowest 8 bits, append the obtained byte to your array, then shift the BigInt right by 8 bits, and repeat as necessary. Integer_to_bytes converts a BigInt to an array of bytes. Simply loop over the byte array and OR each byte into successively higher locations in the output integer. Don't concern yourself with viewing the bytes as ascii encoded, doing the conversion with 7-bit chunks will probably be messy. You'll have to take into account the need for the integer to be a BigInt rather than an unsigned int/long/etc if necessary.īytes_to_integer converts an array of bytes (8-bit octets) to an integer. If you're using a language other than python, it should be relatively simple to translate as it uses fairly generic language constructs.

I don't know what language you're using, but here are methods for bytes_to_integer and integer_to_bytes in python.
