You need ceil(log(2 ** (bytes * 8), 5))
die rolls.
This works best if the number of bytes / rolls is fixed / defined in advance.
Take a calculator.
For each die roll:
- add the result (enter 0 if it was a 6), press
=
- if it's not the last roll: multiply by 5, press
=
While the integer part is > 0:
- If the number (integer part) is even, write a zero, otherwise, write a 1
- Divide by two
Zero-pad the result