1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
Copyright © 2023, ParallelChain Lab
Licensed under the Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
*/
//! Cryptographic primitives like [keypairs](Keypair) and [SHA256](sha256) hashes.
//!
//! ## Generating a Keypair
//!
//! ```
//! // OsRng and ChaCha are good defaults for pseudorandom number generation.
//! use rand::rngs::OsRng;
//! use rand_chacha::{ChaCha20Rng, rand_core::SeedableRng};
//!
//! let mut osrng = OsRng{};
//! let mut chacha20_rng = ChaCha20Rng::from_rng(&mut osrng).unwrap();
//! let keypair = Keypair::generate(&mut chacha20_rng);
//! ```
use ;
/// An Ed25519 keypair.
pub type Keypair = Keypair;
/// An Ed25519 secret key.
pub type SecretKey = SecretKey;
/// An Ed25519 public key.
pub type PublicKey = PublicKey;
/// An Ed25519 signature.
pub type Signature = Signature;
/// 64 bytes that *should be* an Ed25519 signature.
///
/// Can be acquired from [Signature] using [Signature::to_bytes], and converted into it using `try_from`.
pub type SignatureBytes = ;
/// Implemented by [Keypair] and [SecretKey] to [Signer::sign] arbitrary bytesequences.
pub use Signer;
/// Implemented by [Keypair] and [PublicKey] to cryptographically [Verifier::verify] arbitrary bytesequences.
pub use Verifier;
/// Either:
/// - an Ed25519 public key representing an external account, or
/// - a contract address.
pub type PublicAddress = ;
/// A SHA256 hash over some message.
pub type Sha256Hash = ;
/// Compute the SHA256 hash over some data.
// Compute the Binary Merkle Tree root hash over a list of arbitrary data, e.g., [crate::blockchain::Transaction](transactions) or [crate::blockchain::Receipt](receipts).
/// A 256-bit Bloom Filter.
pub type BloomFilter = ;