@@ -5,58 +5,36 @@ template = "doc.html"
55+++
66
77This is a summary of the cryptography functions found in `sys/zuse.hoon`, Arvo's
8−standard library.
8+standard library. This page currently only documents cryptographic functions
9+directly utilized by [Ames](@/docs/arvo/ames/ames.md). `zuse` also contains
10+cryptographic functions relevant to Ethereum such as the `+keccak:crypto` core,
11+but they are currently undocumented.
12+
13+Documentation for [Insecure Hashing](@/docs/hoon/reference/stdlib/2e.md) and the
14+[SHA Hash Family](@/docs/reference/stdlib/3d.md) is found in the Hoon standard
15+library reference.
916
1017## Summary
1118
12−`zuse` contains several cryptosuites. The only ones currently in use are
13−`+ed:crypto`, `+aes:crypto`, and `+crub:crypto`, with the latter being the
14−only one which is implementable as an [`+acru:ames`
19+`zuse` contains several cryptosuites. The ones utilized by Ames are
20+[`+ed:crypto`](#ed), [`+aes:crypto`](#aes), and [`+crub:crypto`](#crub), with
21+the latter being the only one which is implementable as an [`+acru:ames`
1522core](@/docs/arvo/ames/cryptography/#crypto-core).
1623
17−### `+ed:crypto` {#ed}
18−
19−This core contains cryptographic primitives and helper functions for elliptic
20−curve cryptography with [Curve25519](https://en.wikipedia.org/wiki/Curve25519).
21−
22−`+ed:crypto` is used to generate public/private keypairs from a seed for use
23−with [elliptic curve
24−Diffie-Hellman](https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman)
25−key agreements as well as [Elliptic Curve Digital Signature
26−Algorithm](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm).
27−These functionalities are ultimately utilized by [`+crub:crypto`](#crub), the
28−only cryptosuite which [Ames](@/docs/arvo/ames/ames.md) makes use of.
29−
30−Most gates in `+ed:crypto` are [jetted](@/docs/vere/jetting.md), meaning that an
31−external reference library is utilized whenever these functions are called,
32−rather than running in Nock natively. See the [Vere
33−documentation](@/docs/vere/cryptography/#ed) for more information about the
34−library utilized by jets.
35−
36−### `+aes:crypto` {#aes}
37−
38−This core contains cryptographic primitives and helper functions for
39−[AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) symmetric key
40−encryption and decryption. As is the case with `ed:crypto`, these
41−functionalities are utilized by [`+crub:crypto`](#crub), and most functions are
42−jetted. See also the Vere documentation on [AES
43−SIV](@/docs/vere/cryptography/#aes) for more information about the library
44−utilized by jets.
45−
46−### `+crub:crypto` {#crub}
24+## `+crub:crypto` {#crub}
4725
4826`+crub:crypto` implements an
4927[`+acru:ames`](@/docs/arvo/ames/cryptography/#crypto-core) core that implements
5028[Suite B Cryptography](https://en.wikipedia.org/wiki/NSA_Suite_B_Cryptography).
5129
52−It utilizes AES symmetric key encryption and decryption from `+aes:crypto`
30+It utilizes AES symmetric key encryption and decryption from [`+aes:crypto`](#aes)
5331implemented using the Diffie-Hellman key exchange protocol, elliptic curve
54−digital signature algorithm (ECDSA) signing and verification with `+ed:crypto`,
32+digital signature algorithm (ECDSA) signing and verification with [`+ed:crypto`](#ed),
5533and generates public/private key pairs using elliptic curve cryptography with
5634`+ed:crypto`.
5735
58−`+crub:crypto` is called with public encryption and authentication keys and
59−optional secret encryption and authentication keys.
36+A `+crub:crypto` core's payload contains public encryption and authentication
37+keys and optional secret encryption and authentication keys.
6038```hoon
6139 ++ crub !:
6240 ^- acru
@@ -64,10 +42,9 @@ optional secret encryption and authentication keys.
6442 |%
6543 ...
6644```
67−`+crub` cores are typically not created by directly calling the gate, but
68−instead using one of the constructors in `+nu:crub`.
45+`+crub` cores are typically created using one of the constructors in [`+nu:crub`](#nu).
6946
70−#### `+seal:as`
47+### `+seal:as`
7148
7249```hoon
7350 ++ seal ::
@@ -81,7 +58,7 @@ signed message using `+en:siva:aes` with the symmetric key, and then `+jam`s it.
8158
8259Crashes if `sek` is null.
8360
84−#### `+sign:as`
61+### `+sign:as` {#sign:as}
8562
8663```hoon
8764 ++ sign ::
@@ -94,7 +71,7 @@ cell `[signed-message msg]` and `+jam`s it.
9471
9572Crashes if `sek` is null.
9673
97−#### `+sure:as`
74+### `+sure:as`
9875
9976```hoon
10077 ++ sure ::
@@ -106,7 +83,7 @@ Crashes if `sek` is null.
10683`sig` was `msg` signed using the secret key associated to the public key stored
10784at `sgn.pub`. Returns `(unit msg)` if so, null otherwise.
10885
109−#### `+tear:as`
86+### `+tear:as`
11087
11188```hoon
11289 ++ tear ::
@@ -123,7 +100,7 @@ is successful, verifies the decrypted message using authentication key part of
123100
124101Crashes if `sek` is null.
125102
126−#### `+de`
103+### `+de`
127104
128105```hoon
129106 ++ de :: decrypt
@@ -131,10 +108,10 @@ Crashes if `sek` is null.
131108 ...
132109```
133110
134−`+cue`s `txt` then decrypts with the symmetric key `key` using `de:sivc:aes`.
111+`+cue`s `txt` then decrypts with the symmetric key `key` using `+de:sivc:aes`.
135112Returns null in case of failure.
136113
137−#### `+dy`
114+### `+dy`
138115
139116```hoon
140117 ++ dy :: need decrypt
@@ -144,7 +121,7 @@ Returns null in case of failure.
144121
145122Same as `+dy`, but crashes in case of failure.
146123
147−#### `+en`
124+### `+en` {#en}
148125
149126```hoon
150127 ++ en :: encrypt
@@ -154,23 +131,23 @@ Same as `+dy`, but crashes in case of failure.
154131Encrypts `msg` with the symmetric key `key` using `en:sivc:aes`, then `+jam`s
155132it.
156133
157−#### `+fig:ex`
134+### `+fig:ex`
158135
159136Returns the fingerprint (SHA-256) of `+pub:ex`.
160137
161−#### `+pac:ex`
138+### `+pac:ex`
162139
163140Returns the fingerprint (SHA-256) of `+sec:ex`. Crashes if `sek` is null.
164141
165−#### `+pub:ex`
142+### `+pub:ex`
166143
167144Returns the concatenation of `sgn.pub` and `cry.pub`.
168145
169−#### `+sec:ex`
146+### `+sec:ex`
170147
171148Returns the concatenation of `sgn.u.sek` and `cry.u.sek`.
172149
173−#### `+pit:nu`
150+### `+pit:nu` {#nu}
174151
175152```hoon
176153 ++ pit :: create keypair
@@ -186,7 +163,7 @@ private keys.
186163This is how one typically generates a brand new `+crub` core for signing and
187164encrypting your own messages.
188165
189−#### `+nol:nu`
166+### `+nol:nu`
190167
191168```hoon
192169 ++ nol :: activate secret
@@ -198,7 +175,7 @@ Takes in a `ring` from a `+sec:ex:crub` and generates a new `+crub` core with
198175`sek` taken from `+sec:ex` and `pub` generated with `+puck:ed:crypto`. Crashes
199176if `+sec:ex` is not a `+crub` secret key.
200177
201−#### `+com:nu`
178+### `+com:nu`
202179
203180```hoon
204181 ++ com :: activate public
@@ -209,7 +186,37 @@ if `+sec:ex` is not a `+crub` secret key.
209186Takes in a `pass` from a `+pub:ex:crub` and generates a new `+crub` core with
210187`pub` taken from `+pub:ex` and null `sek`.
211188
212−### `+secp:crypto` {#secp}
189+## `+ed:crypto` {#ed}
190+
191+This core contains cryptographic primitives and helper functions for elliptic
192+curve cryptography with [Curve25519](https://en.wikipedia.org/wiki/Curve25519).
193+
194+`+ed:crypto` is primarily used to generate public/private keypairs from a seed
195+for use with [elliptic curve
196+Diffie-Hellman](https://en.wikipedia.org/wiki/Elliptic-curve_Diffie%E2%80%93Hellman)
197+key agreements as well as [Elliptic Curve Digital Signature
198+Algorithm](https://en.wikipedia.org/wiki/Elliptic_Curve_Digital_Signature_Algorithm).
199+These functionalities are ultimately utilized by [`+crub:crypto`](#crub), the
200+only cryptosuite which [Ames](@/docs/arvo/ames/ames.md) makes use of.
201+
202+Most gates in `+ed:crypto` are [jetted](@/docs/vere/jetting.md), meaning that an
203+external reference library is utilized whenever these functions are called,
204+rather than running in Nock natively. See the [Vere
205+documentation](@/docs/vere/cryptography/#ed) for more information about the
206+library utilized by jets.
207+
208+## `+aes:crypto` {#aes}
209+
210+This core contains cryptographic primitives and helper functions for
211+[AES](https://en.wikipedia.org/wiki/Advanced_Encryption_Standard) symmetric key
212+encryption and decryption. As is the case with `ed:crypto`, these
213+functionalities are utilized by [`+crub:crypto`](#crub), and most gates are
214+jetted. See also the Vere documentation on [AES
215+SIV](@/docs/vere/cryptography/#aes) for more information about the library
216+utilized by jets.
213217
214−Utilized for secp256k1 (Ethereum public and private keys).
218+This core contains several doors, each one used for a different variation of AES
219+according to key size and mode. The only ones currently in use are
220+`+siva:aes:crypto` and `+sivc:aes:crypto`, which are 128-bit and
221+256-bit modes of [`AES-SIV`](https://www.aes-siv.com) respectively.
215222