# std.crypto.hash: allow creating hash functions from compositions \(\#11965\) · gitcafe/zig

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

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

Visibility: public

Requested revision: 48fd92365a93a06a57ae0270be5f2614804e5749

Requested commit: 48fd92365a93a06a57ae0270be5f2614804e5749

Commit: 48fd92365a93a06a57ae0270be5f2614804e5749

Tree: 0f9c1fb8ecf0fe46d0729130e0bbb8a78e3bcf1d

Author: Frank Denis

Committer: GitHub

## Message

```
std.crypto.hash: allow creating hash functions from compositions (#11965)

A hash function cascade was a common way to avoid length-extension
attacks with traditional hash functions such as the SHA-2 family.

Add `std.crypto.hash.composition` to do exactly that using arbitrary
hash functions, and pre-define the common SHA2-based ones.

With this, we can now sign and verify Bitcoin signatures in pure Zig.
```

## Parents

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

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