|
1 | 1 | [](https://alire.ada.dev/crates/blake2s.html)
|
2 | 2 |
|
3 |
| -# BLAKE2s for Ada # |
| 3 | +# BLAKE2s for Ada |
4 | 4 |
|
5 |
| -This is a SPARK83 implementation of the [BLAKE2s](https://www.blake2.net/) hash function. As SPARK83 is a strict subset of Ada 87 (ISO-8652:1987), this package should be usable with any standard-compliant Ada compiler. |
| 5 | +This is a SPARK83 implementation of the [BLAKE2s][1] hash function. |
| 6 | +As SPARK83 is a strict subset of Ada 1987 (ISO-8652:1987), this |
| 7 | +package should be usable with any standard-compliant Ada compiler. |
6 | 8 |
|
7 |
| -## BLAKE2s advantages ## |
| 9 | +## BLAKE2s advantages |
8 | 10 |
|
9 |
| -Like SHA-256, BLAKE2s operates on 32-bit words, but is not susceptible to the length extension attacks of the former. Although the FIPS hash functions SHA-512/256 and SHA-3 mitigate the length extension vulnerability of SHA-256, they require 64-bit words for decent performance. Thus, BLAKE2s fills a niche for resource-constrained platforms. It also enjoys a high security margin, as each of the ten BLAKE2s rounds is the equivalent of two ChaCha rounds. |
| 11 | +Like SHA-256, BLAKE2s operates on 32-bit words, but is not susceptible |
| 12 | +to the length extension attacks of the former. Although the FIPS hash |
| 13 | +functions SHA-512/256 and SHA-3 mitigate the length extension |
| 14 | +vulnerability of SHA-256, they require 64-bit words for decent |
| 15 | +performance. Thus, BLAKE2s fills a niche for resource-constrained |
| 16 | +platforms. It also enjoys a high security margin, as each of the ten |
| 17 | +BLAKE2s rounds is the equivalent of two ChaCha rounds. |
10 | 18 |
|
11 |
| -## Build instructions for GNAT ## |
| 19 | +## Build instructions for GNAT |
12 | 20 |
|
13 |
| -To compile the blake2s library and executables, you will need a copy of GCC within your path that includes the GNAT Ada front-end. |
| 21 | +To compile the BLAKE2s library and executables, you will need to have |
| 22 | +installed and accessible within your path copies of [AST NMAKE][2] |
| 23 | +with Ada support and the GCC compiler built with the GNAT Ada |
| 24 | +front-end enabled. |
14 | 25 |
|
15 |
| -To use the included Makefile, run "cd gnat && make" . |
| 26 | +Once the prerequisites are available, simply run `cd gnat && nmake` . |
16 | 27 |
|
17 |
| -## SPARK and Isabelle verification ## |
| 28 | +## SPARK and Isabelle verification |
18 | 29 |
|
19 |
| -This project uses a combination of the original, annotation-based SPARK tool set (search [AdaCore Libre](https://libre.adacore.com/) for the 2012 GPL release) and the HOL-SPARK library bundled within [Isabelle](https://isabelle.in.tum.de/) 2021 to prove the absence of runtime errors. |
| 30 | +This project uses a combination of the original, annotation-based |
| 31 | +SPARK tool set (search [AdaCore Libre][3] for the 2012 GPL release) |
| 32 | +and the HOL-SPARK library bundled within [Isabelle][4] 2021 to prove |
| 33 | +the absence of runtime errors. |
20 | 34 |
|
21 |
| -To verify the proofs, check the Makefile within the project root first to ensure that you have the necessary programs (including the 'isabelle' command) installed within your path. |
| 35 | +To verify the proofs, check the file named `makefile.nmk` within the |
| 36 | +project root first to ensure that you have the necessary programs |
| 37 | +(including the `isabelle` command) installed within your path. |
22 | 38 |
|
23 |
| -If everything is functioning as it should, there should be no undischarged verification conditions. |
| 39 | +If everything is functioning as it should, there should be no |
| 40 | +undischarged verification conditions. |
24 | 41 |
|
25 |
| -## Ada 87 compatibility note ## |
| 42 | +## Ada 1987 compatibility note |
26 | 43 |
|
27 |
| -This package utilizes the Ada 95 pragma "Pure" in the following package specifications: |
| 44 | +This package utilizes the Ada 1995 pragma "Pure" in the following |
| 45 | +package specifications: |
28 | 46 |
|
29 | 47 | * BLAKE2S (common/blake2s.ads)
|
30 | 48 | * Octets (common/octets.ads)
|
31 | 49 | * Octet_Arrays (common/octearra.ads)
|
32 | 50 |
|
33 |
| -Per section 2.8 of the Ada 87 Language Reference Manual, "[a] pragma that is not language-defined has no effect if its identifier is not recognized by the (current) implementation." However, as the pragma is merely advisory to the compiler, it may be removed without adverse effect from these files should it cause any issues. |
34 |
| - |
35 |
| -## Credits |
36 |
| - |
37 |
| -Thanks to Aumasson et al. for releasing the excellent BLAKE hash functions into the public domain, and the [GNAT, SPARK](https://libre.adacore.com/), [Isabelle](https://isabelle.in.tum.de/), and [AdaControl](https://www.adalog.fr/en/adacontrol.html) developers for publishing their tremendously helpful [free software](https://www.gnu.org/philosophy/free-sw.html). |
| 51 | +Per section 2.8 of the Ada 1987 Language Reference Manual, "[a] pragma |
| 52 | +that is not language-defined has no effect if its identifier is not |
| 53 | +recognized by the (current) implementation." However, as the pragma is |
| 54 | +merely advisory to the compiler, it may be removed without adverse |
| 55 | +effect from these files should it cause any issues. |
| 56 | + |
| 57 | +## Acknowledgments |
| 58 | + |
| 59 | +Thanks to Aumasson et al. for releasing the excellent BLAKE hash |
| 60 | +functions into the public domain, and the [GNAT, SPARK][3], |
| 61 | +[Isabelle][4], and [AdaControl][5] developers for publishing their |
| 62 | +tremendously helpful [free software][6]. |
| 63 | + |
| 64 | +[1]: https://www.blake2.net/ |
| 65 | +[2]: https://sr.ht/~lev/ast/ |
| 66 | +[3]: https://libre.adacore.com/ |
| 67 | +[4]: https://isabelle.in.tum.de/ |
| 68 | +[5]: https://www.adalog.fr/en/adacontrol.html |
| 69 | +[6]: https://www.gnu.org/philosophy/free-sw.html |
0 commit comments