Skip to content

Commit 04f7adb

Browse files
Update the docs
1 parent 01f1745 commit 04f7adb

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

docs/specs/ISA.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This specification describes the overall architecture and default VM extensions
66
- [RV32IM](#rv32im-extension): An extension supporting the 32-bit RISC-V ISA with multiplication.
77
- [Native](#native-extension): An extension supporting native field arithmetic for proof recursion and aggregation.
88
- [Keccak-256](#keccak-extension): An extension implementing the Keccak-256 hash function compatibly with RISC-V memory.
9-
- [SHA2-256](#sha2-256-extension): An extension implementing the SHA2-256 hash function compatibly with RISC-V memory.
9+
- [SHA2](#sha2-extension): An extension implementing the SHA-256, SHA-512, and SHA-384 hash functions compatibly with RISC-V memory.
1010
- [BigInt](#bigint-extension): An extension supporting 256-bit signed and unsigned integer arithmetic, including
1111
multiplication. This extension respects the RISC-V memory format.
1212
- [Algebra](#algebra-extension): An extension supporting modular arithmetic over arbitrary fields and their complex
@@ -541,14 +541,16 @@ all memory cells are constrained to be bytes.
541541
| -------------- | ----------- | ----------------------------------------------------------------------------------------------------------------- |
542542
| KECCAK256_RV32 | `a,b,c,1,2` | `[r32{0}(a):32]_2 = keccak256([r32{0}(b)..r32{0}(b)+r32{0}(c)]_2)`. Performs memory accesses with block size `4`. |
543543

544-
### SHA2-256 Extension
544+
### SHA-2 Extension
545545

546-
The SHA2-256 extension supports the SHA2-256 hash function. The extension operates on address spaces `1` and `2`,
546+
The SHA-2 extension supports the SHA-256 and SHA-512 hash functions. The extension operates on address spaces `1` and `2`,
547547
meaning all memory cells are constrained to be bytes.
548548

549549
| Name | Operands | Description |
550550
| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
551551
| SHA256_RV32 | `a,b,c,1,2` | `[r32{0}(a):32]_2 = sha256([r32{0}(b)..r32{0}(b)+r32{0}(c)]_2)`. Does the necessary padding. Performs memory reads with block size `16` and writes with block size `32`. |
552+
| SHA512_RV32 | `a,b,c,1,2` | `[r32{0}(a):64]_2 = sha512([r32{0}(b)..r32{0}(b)+r32{0}(c)]_2)`. Does the necessary padding. Performs memory reads with block size `16` and writes with block size `32`. |
553+
| SHA384_RV32 | `a,b,c,1,2` | `[r32{0}(a):64]_2 = sha384([r32{0}(b)..r32{0}(b)+r32{0}(c)]_2)`. Does the necessary padding. Performs memory reads with block size `16` and writes with block size `32`. Writes 64 bytes to memory: the first 48 are the SHA-384 digest and the last 16 are zeros. |
552554

553555
### BigInt Extension
554556

docs/specs/RISCV.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The default VM extensions that support transpilation are:
55

66
- [RV32IM](#rv32im-extension): An extension supporting the 32-bit RISC-V ISA with multiplication.
77
- [Keccak-256](#keccak-extension): An extension implementing the Keccak-256 hash function compatibly with RISC-V memory.
8-
- [SHA2-256](#sha2-256-extension): An extension implementing the SHA2-256 hash function compatibly with RISC-V memory.
8+
- [SHA2](#sha2-extension): An extension implementing the SHA-256, SHA-512, and SHA-384 hash functions compatibly with RISC-V memory.
99
- [BigInt](#bigint-extension): An extension supporting 256-bit signed and unsigned integer arithmetic, including multiplication. This extension respects the RISC-V memory format.
1010
- [Algebra](#algebra-extension): An extension supporting modular arithmetic over arbitrary fields and their complex field extensions. This extension respects the RISC-V memory format.
1111
- [Elliptic curve](#elliptic-curve-extension): An extension for elliptic curve operations over Weierstrass curves, including addition and doubling. This can be used to implement multi-scalar multiplication and ECDSA scalar multiplication. This extension respects the RISC-V memory format.
@@ -85,11 +85,13 @@ implementation is here. But we use `funct3 = 111` because the native extension h
8585
| ----------- | --- | ----------- | ------ | ------ | ------------------------------------------- |
8686
| keccak256 | R | 0001011 | 100 | 0x0 | `[rd:32]_2 = keccak256([rs1..rs1 + rs2]_2)` |
8787

88-
## SHA2-256 Extension
88+
## SHA-2 Extension
8989

9090
| RISC-V Inst | FMT | opcode[6:0] | funct3 | funct7 | RISC-V description and notes |
9191
| ----------- | --- | ----------- | ------ | ------ | ---------------------------------------- |
9292
| sha256 | R | 0001011 | 100 | 0x1 | `[rd:32]_2 = sha256([rs1..rs1 + rs2]_2)` |
93+
| sha512 | R | 0001011 | 100 | 0x2 | `[rd:64]_2 = sha512([rs1..rs1 + rs2]_2)` |
94+
| sha384 | R | 0001011 | 100 | 0x3 | `[rd:64]_2 = sha384([rs1..rs1 + rs2]_2)`. Last 16 bytes will be set to zeros. |
9395

9496
## BigInt Extension
9597

docs/specs/circuit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ The chips that fall into these categories are:
104104
| FriReducedOpeningChip ||| Case 1. |
105105
| NativePoseidon2Chip ||| Case 1. |
106106
| Rv32HintStoreChip ||| Case 1. |
107-
| Sha256VmChip ||| Case 1. |
107+
| Sha2VmChip ||| Case 1. |
108108

109109
The PhantomChip satisfies the condition because `1 < 3`.
110110

docs/specs/isa-table.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,15 @@ In the tables below, we provide the mapping between the `LocalOpcode` and `Phant
130130
| ------------- | ---------- | ------------- |
131131
| Keccak | `Rv32KeccakOpcode::KECCAK256` | KECCAK256_RV32 |
132132

133-
## SHA2-256 Extension
133+
## SHA-2 Extension
134134

135135
#### Instructions
136136

137137
| VM Extension | `LocalOpcode` | ISA Instruction |
138138
| ------------- | ---------- | ------------- |
139-
| SHA2-256 | `Rv32Sha256Opcode::SHA256` | SHA256_RV32 |
139+
| SHA-2 | `Rv32Sha2Opcode::SHA256` | SHA256_RV32 |
140+
| SHA-2 | `Rv32Sha2Opcode::SHA512` | SHA512_RV32 |
141+
| SHA-2 | `Rv32Sha2Opcode::SHA384` | SHA384_RV32 |
140142

141143
## BigInt Extension
142144

docs/specs/transpiler.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,11 +151,13 @@ Each VM extension's behavior is specified below.
151151
| ----------- | -------------------------------------------------- |
152152
| keccak256 | KECCAK256_RV32 `ind(rd), ind(rs1), ind(rs2), 1, 2` |
153153

154-
### SHA2-256 Extension
154+
### SHA-2 Extension
155155

156156
| RISC-V Inst | OpenVM Instruction |
157157
| ----------- | ----------------------------------------------- |
158158
| sha256 | SHA256_RV32 `ind(rd), ind(rs1), ind(rs2), 1, 2` |
159+
| sha512 | SHA512_RV32 `ind(rd), ind(rs1), ind(rs2), 1, 2` |
160+
| sha384 | SHA384_RV32 `ind(rd), ind(rs1), ind(rs2), 1, 2` |
159161

160162
### BigInt Extension
161163

0 commit comments

Comments
 (0)