Skip to main content

A module to use Intel’s hardware RNG with python’s random class

USAGE

for full docs, see https://rdrand.rtfd.io

# easy_install rdrand
# python
>>> from rdrand import RdRandom
>>> r = RdRandom()

>>>from rdrand import RdSeedom >>>s = RdSeedom()

At this point, r and s will behave just like random

RdRandom is a subclass of random.Random, and behaves like random.Random, but it uses inline assembly to access the hardware RNG using the RdRand instruction. This should be a cryptographically secure drop in replacement for random with a prediction complexity bound of O(2^128), if the Intel random number generator is valid. No mitigation is done to modify the output of the hardware to prevent problems with Intel’s implementation. Caveat Emptor.

RdSeedom is a subclass of random.Random, and behaves like random.Random, but it uses inline assembly to access the hardware RNG using the RdSeed instruction. This should be a cryptographically secure drop in replacement for random returning full entropy bits, if the Intel random number generator is valid. No mitigation is done to modify the output of the hardware to prevent problems with Intel’s implementation. Caveat Emptor.

Also, both RdRandom and RdSeedom include the function r.getrandombytes(i) where i is a positive int. This returns a string of length i filled with random bytes, which is ideal for generating a key or using directly in a protocol.

Please note, as with any security solution, it is possible to subvert this. Please understand the full context before deploying. I am not liable for misuse or clever hackers.

Works with 32 and 64 bit builds of python.

Works with python2 and python3.

Release files for rdrand 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rdrand 1.5.0
File Size Uploaded
rdrand-1.5.0.tar.gz 6.2 kB Details

Release files / rdrand-1.5.0.tar.gz

Download URL rdrand-1.5.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d9917d0a365af31817914beadd7b8db200ca49a565e5f33fa90801fbc4d965ae
BLAKE2b-256 checksum
How to use checksums
58b8a6060f0973f9927c68ff937812ed25a12911a493180703e4cb43f8ffc624
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.5.0 This release

1 release file

1.4.9

1 release file

1.0.1

1 release file

1.0.0

1 release file

0.9.9

1 release file

0.9.0

1 release file

0.5.3

1 release file

0.5.2

1 release file

0.5.1

1 release file

0.5.0

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page