[riot-notifications] [RIOT-OS/RIOT] Pr random sha1prng optimize (#14053)
notifications at github.com
Mon May 11 10:52:47 CEST 2020
### Contribution description
This PR optimizes the SHA1PRNG in three ways:
- Rename `SEED_SIZE` macro to `STATE_SIZE` to be more precise. Furthermore, initialize its value with the digest length given by SHA1 (`SHA1_DIGEST_LENGTH`).
- Use `random_init_by_array` in `random_init`.
- Get rid of the redundant [SHA-1 update](https://github.com/RIOT-OS/RIOT/blob/master/sys/random/sha1prng.c#L65) during state transition. The SHA-1 context is [reset during the next cycle](https://github.com/RIOT-OS/RIOT/blob/master/sys/random/sha1prng.c#L95) anyway.
### Testing procedure
- Run *tests/rng* with and without this PR.
- Dump a couple of numbers (`dump 100`) and compare both results.
-> Should be the same.
- On a board, run `speed`.
-> Should be slightly faster now.
### Issues/PRs references
You can view, comment on, or merge this pull request online at:
-- Commit Summary --
* sys/random/sha1prng: rename seed size to state size
* sys/random/sha1prng: remove redundant sha1 update in state transistion
* sys/random/sha1prng: make random_init use init_by_array
-- File Changes --
M sys/random/sha1prng.c (33)
-- Patch Links --
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the notifications