-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
416c2ee
commit 8136341
Showing
4 changed files
with
39 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
use crate::prelude::*; | ||
|
||
/// We split the hardened derivation entity index "space" in | ||
/// two halves. The first half is used for unsecurified entities, | ||
/// and the second half is used for securified entities. | ||
/// | ||
/// The Unsecurified half works as it does today, with hardened | ||
/// `u32` values, where hardened denotes addition of `2^31`. | ||
/// | ||
/// The Securified half is a new concept, where we offset the | ||
/// `u32` value with half of the 2^31 space, i.e. `2^30`. | ||
#[derive(Clone, Copy, PartialEq, Eq, Hash, derive_more::Display, derive_more::Debug)] | ||
pub enum KeySpace { | ||
/// Used by FactorInstances controlling | ||
/// unsecurified entities, called "VECI"s | ||
/// Virtual Entity Creating (Factor)Instances. | ||
#[display("Unsecurified")] | ||
#[debug("Unsecurified")] | ||
Unsecurified, | ||
|
||
/// Used by FactorInstances in MatrixOfFactorInstances | ||
/// for securified entities. | ||
/// | ||
/// This is the entity base index value, `u32` `+ 2^30`. | ||
/// | ||
/// We use `6^` notation to indicate: `6' + 2^30`, where `'`, | ||
/// is the standard notation for hardened indices. | ||
#[display("Securified")] | ||
#[debug("Securified")] | ||
Securified, | ||
} | ||
|
||
impl KeySpace { | ||
pub fn both() -> [Self; 2] { | ||
[Self::Unsecurified, Self::Securified] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters