Apr-28-2017, 09:31 AM
If the values are from /dev/random then the real question is bytes to hex and back... In which case you just skip the utf-8 encode/decode steps (and make sure you open /dev/random in binary mode.
import codecs with open("/dev/urandom","rb") as f: bytes=f.read(32) hexbytes=codecs.encode(bytes,'hex') print(hexbytes) bytesback=codecs.decode(hexbytes,'hex') print(bytesback==bytes)
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Your one-stop place for all your GIMP needs: gimp-forum.net