Skip to content

Commit

Permalink
SHA256 implementation note added in README.
Browse files Browse the repository at this point in the history
  • Loading branch information
tfpf committed Oct 1, 2023
1 parent 0a10e4f commit 4d981a2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
| Additional Input | No |
| Personalisation String | No |

* In C, a byte need not be 8 bits wide. However, this implementation uses the term 'byte' to refer to an 8-bit number.
Hence, fixed-width integer types are used liberally.
* SHA-256 has been implemented from scratch, because I wanted this package to have no dependencies.
* However, if OpenSSL development libraries are found, its SHA-256 implementation is used if the C compiler provides
8-bit bytes.
* `/dev/urandom` is read to obtain entropy for seeding and reseeding.
* It is assumed to always provide sufficient entropy.
* Nonces are generated by appending a monotonically increasing sequence number to the timestamp.
Expand All @@ -17,8 +21,6 @@
which load the library at the same time will also generate the same nonce, because the sequence number is
initialised to 0.) Which shouldn't be a problem, because their entropy inputs will be different with high
probability.
* In C, a byte need not be 8 bits wide. However, this implementation uses the term 'byte' to refer to an 8-bit number.
Hence, fixed-width integer types are used liberally.
* The `hd` argument of any function (where applicable) denotes the HDRBG object to use.
* If it is `NULL`, the internal HDRBG object is used.
* For instance, `hdrbg_rand(NULL)` and `hdrbg_rand(foo)` are both valid invocations of `hdrbg_rand`—the former
Expand Down

0 comments on commit 4d981a2

Please sign in to comment.