Skip to content

Commit 8bc6e94

Browse files
Update the docs
1 parent 9a13025 commit 8bc6e94

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
@@ -538,14 +538,16 @@ all memory cells are constrained to be bytes.
538538
| -------------- | ----------- | ----------------------------------------------------------------------------------------------------------------- |
539539
| 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`. |
540540

541-
### SHA2-256 Extension
541+
### SHA-2 Extension
542542

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

546546
| Name | Operands | Description |
547547
| ----------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
548548
| 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`. |
549+
| 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`. |
550+
| 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. |
549551

550552
### BigInt Extension
551553

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.
@@ -78,11 +78,13 @@ the guest must take care to validate all data and account for behavior in cases
7878
| ----------- | --- | ----------- | ------ | ------ | ------------------------------------------- |
7979
| keccak256 | R | 0001011 | 100 | 0x0 | `[rd:32]_2 = keccak256([rs1..rs1 + rs2]_2)` |
8080

81-
## SHA2-256 Extension
81+
## SHA-2 Extension
8282

8383
| RISC-V Inst | FMT | opcode[6:0] | funct3 | funct7 | RISC-V description and notes |
8484
| ----------- | --- | ----------- | ------ | ------ | ---------------------------------------- |
8585
| sha256 | R | 0001011 | 100 | 0x1 | `[rd:32]_2 = sha256([rs1..rs1 + rs2]_2)` |
86+
| sha512 | R | 0001011 | 100 | 0x2 | `[rd:64]_2 = sha512([rs1..rs1 + rs2]_2)` |
87+
| sha384 | R | 0001011 | 100 | 0x3 | `[rd:64]_2 = sha384([rs1..rs1 + rs2]_2)`. Last 16 bytes will be set to zeros. |
8688

8789
## BigInt Extension
8890

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
@@ -128,13 +128,15 @@ In the tables below, we provide the mapping between the `LocalOpcode` and `Phant
128128
| ------------- | ---------- | ------------- |
129129
| Keccak | `Rv32KeccakOpcode::KECCAK256` | KECCAK256_RV32 |
130130

131-
## SHA2-256 Extension
131+
## SHA-2 Extension
132132

133133
#### Instructions
134134

135135
| VM Extension | `LocalOpcode` | ISA Instruction |
136136
| ------------- | ---------- | ------------- |
137-
| SHA2-256 | `Rv32Sha256Opcode::SHA256` | SHA256_RV32 |
137+
| SHA-2 | `Rv32Sha2Opcode::SHA256` | SHA256_RV32 |
138+
| SHA-2 | `Rv32Sha2Opcode::SHA512` | SHA512_RV32 |
139+
| SHA-2 | `Rv32Sha2Opcode::SHA384` | SHA384_RV32 |
138140

139141
## BigInt Extension
140142

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)