Skip to content

Commit

Permalink
add keccak and sha3 hash variants to Aleo instructions opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
collinc97 committed Sep 13, 2023
1 parent e04d739 commit 0116f4b
Show file tree
Hide file tree
Showing 2 changed files with 225 additions and 22 deletions.
20 changes: 16 additions & 4 deletions documentation/advanced/the_aleo_curves/00_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ title: Overview
sidebar_label: Overview
---

<!----------------------------------------------------------------------------->
<!-------------------- THIS MARKDOWN FILE IS AUTOGENERATED -------------------->
<!----------------------------------------------------------------------------->

Aleo uses a tailored set of pairing-friendly elliptic curves to perform efficient proof generation and verification.

| | Edwards BLS12 | BLS12-377 |
Expand All @@ -19,3 +15,19 @@ Aleo uses a tailored set of pairing-friendly elliptic curves to perform efficien
| G2 Compressed Size* | N/A | 96 bytes |

\* rounded to multiples of 8 bytes.

## Keccak
The sponge construction `Sponge[f, pad, r]` is a function that takes a variable-length input
and produces a fixed-length output (the hash value).
The permutation `f` is a function that takes a fixed-length input and produces a fixed-length output,
defined as `f = Keccak-f[b]`, where `b := 25 * 2^l` is the width of the permutation,
and `l` is the log width of the permutation.
For our case, `l = 6`, thus `b = 1600`.
The padding rule `pad` is a function that takes a variable-length input and produces a fixed-length output.
In Keccak, `pad` is a multi-rate padding, defined as `pad(M) = M || 0x01 || 0x00…0x00 || 0x80`,
where `M` is the input data, and `0x01 || 0x00…0x00 || 0x80` is the padding.
In SHA-3, `pad` is a SHAKE, defined as `pad(M) = M || 0x06 || 0x00…0x00 || 0x80`,
where `M` is the input data, and `0x06 || 0x00…0x00 || 0x80` is the padding.
The bitrate `r` is the number of bits that are absorbed into the sponge state in each iteration
of the absorbing phase.
In addition, the capacity is defined as `c := b - r`.
Loading

0 comments on commit 0116f4b

Please sign in to comment.