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: starknet-crypto/README.md
+9-1Lines changed: 9 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,14 @@
1
1
# Low-level cryptography utilities for Starknet
2
2
3
-
`starknet-crypto` contains utilities for performing **low-level** cryptographic operations in Starknet.
3
+
`starknet-crypto` contains utilities for performing **low-level** cryptographic operations in Starknet:
4
+
5
+
- ECDSA operations
6
+
- Signing hashes
7
+
- Verifying signatures
8
+
- Recovering public keys from signatures
9
+
- Pedersen hash
10
+
- Poseidon hash
11
+
- RFC-6979
4
12
5
13
> _You're advised to use high-level crypto utilities implemented by the `starknet-core` crate (or use it through the `starknet::core` re-export) if you're not familiar with cryptographic primitives. Using these low-level functions incorrectly could result in leaking your private key, for example._
Copy file name to clipboardExpand all lines: starknet-crypto/src/ecdsa.rs
+26-18Lines changed: 26 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,22 @@ use crate::{
7
7
use starknet_types_core::curve::{AffinePoint,ProjectivePoint};
8
8
use starknet_types_core::felt::Felt;
9
9
10
+
/// The (exclusive) upper bound on many ECDSA-related elements based on the original C++
11
+
/// implementation from [`crypto-cpp`](https://github.com/starkware-libs/crypto-cpp).
12
+
///
13
+
/// The C++ implementation [imposes](https://github.com/starkware-libs/crypto-cpp/blob/78e3ed8dc7a0901fe6d62f4e99becc6e7936adfd/src/starkware/crypto/ecdsa.cc#L23)
14
+
/// an upper bound of `0x0800000000000000000000000000000000000000000000000000000000000000`.
15
+
///
16
+
/// When a compuated value is greater than or equal to this bound, the modulus is taken to ensure
17
+
/// the resulting value falls under the bound.
10
18
constELEMENT_UPPER_BOUND:Felt = Felt::from_raw([
11
19
576459263475450960,
12
20
18446744073709255680,
13
21
160989183,
14
22
18446743986131435553,
15
23
]);
16
24
17
-
/// Stark ECDSA signature
25
+
/// Stark ECDSA signature.
18
26
#[derive(Debug)]
19
27
pubstructSignature{
20
28
/// The `r` value of a signature
@@ -23,7 +31,7 @@ pub struct Signature {
23
31
pubs:Felt,
24
32
}
25
33
26
-
/// Stark ECDSA signature with `v`
34
+
/// Stark ECDSA signature with `v`, useful for recovering the public key.
27
35
#[derive(Debug)]
28
36
pubstructExtendedSignature{
29
37
/// The `r` value of a signature
@@ -70,9 +78,9 @@ impl core::fmt::Display for ExtendedSignature {
70
78
71
79
/// Computes the public key given a Stark private key.
0 commit comments