Increased output block size from 64 to 96 bytes; now using 8 counter values, instead...
[fast-key-erasure-rng-java.git] / README.md
blob26b4af98a9cc60113ddcbcb77f90797311003f35
1 # FastKeyErasureRNG
3 **Fast-key-erasure random-number generator for Java**
5 A cryptographically secure [RNG](https://en.wikipedia.org/wiki/Random_number_generation), based on [AES-256](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) “CTR” mode, with high performance and forward secrecy.
7 FastKeyErasureRNG has been shown to pass the [Dieharder](https://webhome.phy.duke.edu/~rgb/General/dieharder.php) random number generator testing suite.
9 ## Algorithm
11 This implementation is based on *“Fast-key-erasure random-number generators”* by D. J. Bernstein.
13 Please see here for details:  
14 <https://blog.cr.yp.to/20170723-random.html>
16 ## Usage
18 The **`FastKeyErasureRNG`** class implements the standard [`Random`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/Random.html) interface.
20 Example of usage:
22 ```java
23 import io.github.deajl3ka.fast_key_erasure.FastKeyErasureRNG;
25 public class Example {
26     public static void main(String[] args) {
27         final FastKeyErasureRNG random = FastKeyErasureRNG.current();
28         for (int i = 0; i < 42; ++i) {
29             System.out.println(random.nextLong());
30         }
31     }
33 ```
35 ### Thread safety
37 The `FastKeyErasureRNG` class is **not** thread-safe by itself.
39 It is recommended that each thread uses its own separate instance! Use the *static* method `FastKeyErasureRNG.current()` to obtain an instance for the current thread.
41 ## Website
43 Git mirrors for this project:
45 * <https://github.com/dEajL3kA/FastKeyErasureRNG>
46 * <https://gitlab.com/deajl3ka1/fast-key-erasure-rng-java.git>
47 * <https://repo.or.cz/fast-key-erasure-rng-java.git>
49 ## Contact information
51 E-Mail:  
52 <Cumpoing79@web.de>
54 OpenPGP key:  
55 [`F81B 9C6C 6C3A 7F46 4173  3F5E E9C6 473D 4E97 DAD1`](https://keys.openpgp.org/vks/v1/by-fingerprint/F81B9C6C6C3A7F4641733F5EE9C6473D4E97DAD1)
57 ## License
59 Copyright (c) 2023 "dEajL3kA" &lt;Cumpoing79@web.de&gt;  
60 This work has been released under the MIT license. See [LICENSE.txt](LICENSE.txt) for details!
62 ### Acknowledgement
64 FastKeyErasureRNG *test-only* dependencies:
66 * **[@API Guardian](https://github.com/apiguardian-team/apiguardian) – provides the `@API` annotation**  
67   Apache License 2.0  
68   Copyright (c) 2002-2017 The @API Guardian Team
70 * **[Ascii85](https://github.com/fzakaria/ascii85) – library for working with Ascii85**  
71   Apache License 2.0  
72   Copyright (c) 2016-2020 Farid Zakaria
74 * **[JUnit 5](https://github.com/junit-team/junit5/) – programmer-friendly testing framework**  
75   Eclipse Public License 2.0  
76   Copyright (c) 2015-2023 The JUnit Team