# Add Sha2 functions · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/2659ac01be85662265be6e7fcdd8e03dcade1c50)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 2659ac01be85662265be6e7fcdd8e03dcade1c50

Requested commit: 2659ac01be85662265be6e7fcdd8e03dcade1c50

Commit: 2659ac01be85662265be6e7fcdd8e03dcade1c50

Tree: d4f95c92612d336ecda3c9d1fcb314574a1f0914

Author: Marc Tiehuis

Committer: Marc Tiehuis

## Message

````
Add Sha2 functions

We take the fastest time measurement taken across multiple runs. Tested
across multiple compiler flags and the best chosen.

```
Cpu: Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
Gcc: 7.2.1 20171224
Clang: 5.0.1
Zig: 0.1.1.304f6f1d
```

See https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly.

```
Gcc -O2
    219 Mb/s
Clang -O2
    213 Mb/s
Zig --release-fast
    284 Mb/s
Zig --release-safe
    211 Mb/s
Zig
    6 Mb/s
```

```
Gcc -O2
    350 Mb/s
Clang -O2
    354 Mb/s
Zig --release-fast
    426 Mb/s
Zig --release-safe
    300 Mb/s
Zig
    11 Mb/s
```

````

## Parents

- [a2315cfbfcfe33a2b9010994a1da6674854151e9](https://git.cafe/gitcafe/zig/commit/a2315cfbfcfe33a2b9010994a1da6674854151e9?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/2659ac01be85662265be6e7fcdd8e03dcade1c50?format=markdown)
