Spurred by this twitter conversation.
random.SystemRandom
uses os.urandom
as a source of bytes, but doesn't provide a way to use a different source of bytes.
So stream_random.py
is exactly that.
Then kms_random.py
has raw and buffered bytestreams pulling from KMS.GenerateRandom
.
The main interface is kms_random.get_kms_random(boto3_session, buffer_size=None)
. The default buffer size is 16, chosen arbitrarily.
I do not vouch for the randomness properties of the results.