darkfi_sdk/crypto/constants.rs
1/* This file is part of DarkFi (https://dark.fi)
2 *
3 * Copyright (C) 2020-2025 Dyne.org foundation
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as
7 * published by the Free Software Foundation, either version 3 of the
8 * License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19pub mod fixed_bases;
20pub mod sinsemilla;
21pub mod util;
22
23pub use fixed_bases::{
24 ConstBaseFieldElement, NullifierK, OrchardFixedBases, OrchardFixedBasesFull, ValueCommitV, H,
25};
26
27/// Domain prefix used for Schnorr signatures, with `hash_to_scalar`.
28pub const DRK_SCHNORR_DOMAIN: &[u8] = b"DarkFi:Schnorr";
29
30/// Domain prefix used for block hashes, with `hash_to_curve`.
31pub const BLOCK_HASH_DOMAIN: &str = "DarkFi:Block";
32
33pub const MERKLE_DEPTH_ORCHARD: usize = 32;
34
35// TODO: move to merkle_node.rs
36pub const MERKLE_DEPTH: u8 = MERKLE_DEPTH_ORCHARD as u8;
37
38pub const SPARSE_MERKLE_DEPTH: usize = 3;
39
40#[allow(dead_code)]
41/// $\ell^\mathsf{Orchard}_\mathsf{base}$
42pub(crate) const L_ORCHARD_BASE: usize = 255;
43
44/// $\ell^\mathsf{Orchard}_\mathsf{scalar}$
45pub(crate) const L_ORCHARD_SCALAR: usize = 255;
46
47/// $\ell_\mathsf{value}$
48pub(crate) const L_VALUE: usize = 64;
49
50/// WIF checksum length
51pub const WIF_CHECKSUM_LEN: usize = 4;
52
53/// Domain prefix used for Schnorr signatures, with `hash_to_scalar`.
54pub const DRK_TOKEN_ID_PERSONALIZATION: &[u8] = b"DarkFi:DRK_Native_Token";