mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-12-14 15:45:09 -05:00
* deleted old version wolfSSL before updating * updated wolfSSL to the latest version(v4.4.0) * updated wolfSSL to the latest version(v4.4.0) * added macros for timing resistance Co-authored-by: RichardBarry <3073890+RichardBarry@users.noreply.github.com> Co-authored-by: Ming Yue <mingyue86010@gmail.com>
30 lines
781 B
ReStructuredText
30 lines
781 B
ReStructuredText
Random Number Generation
|
|
========================
|
|
|
|
A **cryptographically secure pseudo-random number generator** (CSPRNG) is a
|
|
**pseudo-random number generator** (PRNG) with properties that make it suitable
|
|
for use in cryptography.
|
|
|
|
Using the standard random module APIs for cryptographic keys or initialization
|
|
vectors can result in major security issues depending on the algorithms in use.
|
|
|
|
``wolfcrypt`` provides the following CSPRNG implementation:
|
|
|
|
.. module:: wolfcrypt.random
|
|
|
|
.. autoclass:: Random
|
|
:members:
|
|
|
|
|
|
Example
|
|
-------
|
|
|
|
>>> from wolfcrypt.random import Random
|
|
>>>
|
|
>>> r = Random()
|
|
>>> b = r.byte()
|
|
>>> b # doctest: +SKIP
|
|
b'\x8c'
|
|
>>> b16 = r.bytes(16)
|
|
>>> b16 # doctest: +SKIP
|
|
b']\x93nk\x95\xbc@\xffX\xab\xdcB\xda\x11\xf7\x03'
|