You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: crates/lib/core/docs/crypto/dsa/ecdsa_k256_keccak.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,6 @@
2
2
## miden::core::crypto::dsa::ecdsa_k256_keccak
3
3
| Procedure | Description |
4
4
| ----------- | ------------- |
5
-
| verify | Verifies an secp256k1 ECDSA signature compatible with `miden-crypto::ecdsa_k256_keccak`.<br /><br />This wrapper mirrors the materialization performed in `miden-crypto::ecdsa_k256_keccak`: given<br />a public key commitment and the original message, it reconstructs the calldata expected by the<br />precompile (public key bytes, Keccak256(message), signature). The public key and signature are<br />supplied via the advice stack, and can be obtained with the `ecdsa_k256_keccak` function.<br /><br />Inputs:<br />Operand stack: [PK_COMM, MSG, ...]<br />Advice stack: [PK[9] \| SIG_BYTES[17] \| ...]<br />Outputs:<br />Operand stack: []<br />Advice stack: []<br /><br />Local memory layout (element addresses):<br />- locaddr[0 ..9 ] : compressed public key (33 bytes packed as 9 felts)<br />- locaddr[12..20] : message bytes (MSG written as eight u32 limbs)<br />- locaddr[20..28] : keccak256(message) digest (8 felts)<br />- locaddr[28..45] : signature (66 bytes packed as 17 felts)<br /><br />The procedure traps if the public key in the advice stack does not hash to `PK_COMM`;<br />otherwise it returns cleanly after emitting the deferred verification request.<br /> |
6
-
| verify_prehash | Verifies an ECDSA signature with pre-hashed message using deferred execution.<br />This procedure is intended for manual signature verification where the caller<br />has already computed the message digest.<br /><br />The caller provides the public key, the pre-hashed message digest, and the signature data in<br />memory. This routine forwards the request to the host precompile and returns the boolean result.<br />In typical flows the digest is obtained from `keccak256::hash_bytes`, but any 32-byte prehash<br />is accepted.<br /><br />Input: `[pk_ptr, digest_ptr, sig_ptr, ...]`<br />Output: `[result, ...]`<br /><br />Where:<br />- `pk_ptr`: word-aligned memory address containing the 33-byte compressed secp256k1 public key<br />- `digest_ptr`: word-aligned memory address containing the 32-byte message digest<br />- `sig_ptr`: word-aligned memory address containing the 66-byte signature<br />- `result`: 1 if the signature is valid, 0 if invalid<br /><br />All data must be stored in memory as packed u32 values (little-endian), with unused bytes<br />in the final u32 set to zero.<br /> |
7
-
| verify_prehash_impl | Internal implementation of ECDSA signature verification via deferred computation.<br />This procedure is intended for manual signature verification where the caller<br />has already computed the message digest.<br /><br />Emits an event to trigger the precompile handler, reads the verification result from<br />the advice stack, and computes the commitment and tag for tracking deferred verification.<br /><br />This procedure mimics the `ecdsa_secp256k1::PublicKey::verify_prehash()` function from<br />`miden-crypto`, which takes a pre-hashed message that the caller must provide<br />(e.g. obtained using the keccak256 precompile).<br /><br />Input: `[pk_ptr, digest_ptr, sig_ptr, ...]`<br />Output: `[COMM, TAG, result, ...]`<br /><br />Where:<br />- `pk_ptr`: word-aligned memory address containing 33-byte public key<br />- `digest_ptr`: word-aligned memory address containing 32-byte digest<br />- `sig_ptr`: word-aligned memory address containing 66-byte signature<br />- `COMM`: commitment to calldata computed as<br />`Rpo256(Rpo256(Rpo256(pk) \|\| Rpo256(digest)) \|\| Rpo256(sig))`<br />- `TAG`: `[ECDSA_VERIFY_EVENT, result, 0, 0]`<br />- `result`: 1 if signature is valid, 0 if invalid<br /> |
5
+
| verify | Verifies an secp256k1 ECDSA signature compatible with `miden-crypto::ecdsa_k256_keccak`.<br /><br />This wrapper mirrors the materialization performed in `miden-crypto::ecdsa_k256_keccak`: given<br />a public key commitment and the original message, it reconstructs the calldata expected by the<br />precompile (public key bytes, Keccak256(message), signature). The public key and signature are<br />supplied via the advice stack, and can be obtained with the `ecdsa_k256_keccak` function.<br /><br />Inputs:<br />Operand stack: [PK_COMM, MSG, ...]<br />Advice stack: [PK[9] \| SIG[17] \| ...]<br />Outputs:<br />Operand stack: []<br />Advice stack: []<br /><br />Where:<br />- `PK_COMM`: RPO hash commitment of the 32-byte ECDSA public key<br />- `MSG`: single word (4 field elements) representing the message to verify<br />- `PK[9]`: 33-byte public key packed as 9 field elements on advice stack<br />- `SIG[17]`: 65-byte signature packed as 17 field elements on advice stack<br /><br />Local memory layout (element addresses):<br />- locaddr[0 ..9 ] : compressed public key (33 bytes packed as 9 felts)<br />- locaddr[12..20] : message bytes (MSG written as eight u32 limbs)<br />- locaddr[20..28] : keccak256(message) digest (8 felts)<br />- locaddr[28..45] : signature (65 bytes packed as 17 felts)<br /><br />The procedure traps if:<br />- The public key does not hash to `PK_COMM` (invalid commitment)<br />- The signature verification fails<br /> |
6
+
| verify_prehash | Verifies an ECDSA signature with pre-hashed message using deferred execution.<br /><br />This procedure is intended for manual signature verification where the caller<br />has already computed the message digest.<br /><br />The caller provides the public key, the pre-hashed message digest, and the signature data in<br />memory. This routine forwards the request to the host precompile and returns the boolean result.<br />In typical flows the digest is obtained from `keccak256::hash_bytes`, but any 32-byte prehash<br />is accepted.<br /><br />Input: `[pk_ptr, digest_ptr, sig_ptr, ...]`<br />Output: `[result, ...]`<br /><br />Where:<br />- `pk_ptr`: word-aligned memory address containing the 33-byte compressed secp256k1 public key<br />- `digest_ptr`: word-aligned memory address containing the 32-byte message digest<br />- `sig_ptr`: word-aligned memory address containing the 65-byte signature<br />- `result`: 1 if the signature is valid, 0 if invalid<br /><br />All data must be stored in memory as packed u32 values (little-endian), with unused bytes<br />in the final u32 set to zero.<br /> |
7
+
| verify_prehash_impl | Internal implementation of ECDSA signature verification via deferred computation.<br />This procedure is intended for manual signature verification where the caller<br />has already computed the message digest.<br /><br />Emits an event to trigger the precompile handler, reads the verification result from<br />the advice stack, and computes the commitment and tag for tracking deferred verification.<br /><br />This procedure mimics the `ecdsa_secp256k1::PublicKey::verify_prehash()` function from<br />`miden-crypto`, which takes a pre-hashed message that the caller must provide<br />(e.g. obtained using the keccak256 precompile).<br /><br />Input: `[pk_ptr, digest_ptr, sig_ptr, ...]`<br />Output: `[COMM, TAG, result, ...]`<br /><br />Where:<br />- `pk_ptr`: word-aligned memory address containing 33-byte public key<br />- `digest_ptr`: word-aligned memory address containing 32-byte digest<br />- `sig_ptr`: word-aligned memory address containing 65-byte signature<br />- `COMM`: commitment to calldata computed as<br />`Rpo256(Rpo256(Rpo256(pk) \|\| Rpo256(digest)) \|\| Rpo256(sig))`<br />- `TAG`: `[ECDSA_VERIFY_EVENT, result, 0, 0]`<br />- `result`: 1 if signature is valid, 0 if invalid<br /> |
Copy file name to clipboardExpand all lines: crates/lib/core/docs/crypto/dsa/eddsa_ed25519.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,5 +3,5 @@
3
3
| Procedure | Description |
4
4
| ----------- | ------------- |
5
5
| verify | Verifies an Ed25519 EdDSA signature compatible with `miden-crypto::eddsa_25519_sha512`.<br /><br />This wrapper mirrors the materialization performed in `miden-crypto::eddsa_25519_sha512`: given<br />a public key commitment and the original message, it reconstructs the calldata expected by the<br />precompile (public key bytes, SHA512(R \|\| PK \|\| MSG), signature). The public key and signature<br />are supplied via the advice stack, and can be obtained with the `eddsa_sign` function.<br /><br />Inputs:<br />Operand stack: [PK_COMM, MSG, ...]<br />Advice stack: [PK[8] \| SIG[16] \| ...]<br />Outputs:<br />Operand stack: []<br />Advice stack: []<br /><br />Where:<br />- `PK_COMM`: RPO hash commitment of the 32-byte Ed25519 public key<br />- `MSG`: single word (4 field elements) representing the message to verify<br />- `PK[8]`: 32-byte public key packed as 8 field elements on advice stack<br />- `SIG[16]`: 64-byte signature packed as 16 field elements on advice stack<br /><br />Local memory layout (element addresses):<br />- locaddr[0..8]: public key (32 bytes packed as 8 felts)<br />- locaddr[8..16]: message (32 bytes = 8 felts)<br />- locaddr[16..32]: signature (64 bytes packed as 16 felts)<br />- locaddr[32..56]: SHA512 input buffer (R \|\| PK \|\| MSG = 96 bytes = 24 felts)<br />- locaddr[56..72]: k_digest = SHA512(R \|\| PK \|\| MSG) (64 bytes = 16 felts)<br /><br />The procedure traps if:<br />- The public key does not hash to `PK_COMM` (invalid commitment)<br />- The signature verification fails<br /> |
6
-
|verify_with_unchecked_k_digest| Verifies an EdDSA (Ed25519) signature with a pre-computed nonce digest.<br /><br />This procedure uses deferred verification via a precompile. The actual cryptographic<br />verification is performed by the host, and the result is provided via the advice stack.<br /><br />Input: `[pk_ptr, k_digest_ptr, sig_ptr, ...]`<br />Output: `[result, ...]`<br /><br />Where:<br />- `pk_ptr`: word-aligned memory address containing the 32-byte Ed25519 public key<br />- `k_digest_ptr`: word-aligned memory address containing the 64-byte challenge hash `k`<br />- `sig_ptr`: word-aligned memory address containing the 64-byte Ed25519 signature<br />- `result`: 1 if the signature is valid, 0 otherwise<br /><br />All data must be stored in memory as packed u32 field elements (little-endian), with unused limbs<br />in the final word set to zero.<br /> |
7
-
|verify_with_unchecked_k_digest_impl| Internal implementation of EdDSA verification via deferred computation.<br /><br />Emits an event to trigger the host precompile, reads the verification result from the<br />advice stack, and computes the commitment/tag pair used for deferred verification.<br /><br />Input: `[pk_ptr, k_digest_ptr, sig_ptr, ...]`<br />Output: `[COMM, TAG, result, ...]`<br /><br />Where:<br />- `COMM`: `Rpo256(Rpo256(Rpo256(pk) \|\| Rpo256(k_digest)) \|\| Rpo256(sig))`<br />- `TAG`: `[EDDSA_VERIFY_EVENT, result, 0, 0]`<br />- `result`: host verification result (1 or 0)<br /> |
6
+
|verify_prehash| Verifies an EdDSA (Ed25519) signature with a pre-computed nonce digest.<br /><br />This procedure is intended for manual signature verification where the caller<br />has already computed the message digest.<br /><br />This procedure uses deferred verification via a precompile. The actual cryptographic<br />verification is performed by the host, and the result is provided via the advice stack.<br /><br />Input: `[pk_ptr, digest_ptr, sig_ptr, ...]`<br />Output: `[result, ...]`<br /><br />Where:<br />- `pk_ptr`: word-aligned memory address containing the 32-byte Ed25519 public key<br />- `digest_ptr`: word-aligned memory address containing the 64-byte challenge hash `k`<br />- `sig_ptr`: word-aligned memory address containing the 64-byte Ed25519 signature<br />- `result`: 1 if the signature is valid, 0 otherwise<br /><br />All data must be stored in memory as packed u32 field elements (little-endian), with unused limbs<br />in the final word set to zero.<br /> |
7
+
|verify_prehash_impl| Internal implementation of EdDSA verification via deferred computation.<br /><br />Emits an event to trigger the host precompile, reads the verification result from the<br />advice stack, and computes the commitment/tag pair used for deferred verification.<br /><br />Input: `[pk_ptr, k_digest_ptr, sig_ptr, ...]`<br />Output: `[COMM, TAG, result, ...]`<br /><br />Where:<br />- `COMM`: `Rpo256(Rpo256(Rpo256(pk) \|\| Rpo256(k_digest)) \|\| Rpo256(sig))`<br />- `TAG`: `[EDDSA_VERIFY_EVENT, result, 0, 0]`<br />- `result`: host verification result (1 or 0)<br /> |
0 commit comments