Coverage for nuts.utils : 89%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
""" Takes a version like '1.0' or '2.1' and encodes it into a single byte. """
""" Takes a byte version and decodes it into human-readable <major>.<minor> format. """
""" Read `num_bytes` from the RNG. """ with open('/dev/hwrng', 'r') as hwrng: return hwrng.read(num_bytes) else:
""" Encode a positiv integer to a variable length byte string. """ raise ArgumentError('Cannot encode negative numbers as varint!')
""" Decode a variable length byte string into a positive integer.
Note that input must be an array of ints (the way python 3 iterates over a byte string). """ |