Skip to content

Commit

Permalink
define KeyCustomInit trait
Browse files Browse the repository at this point in the history
  • Loading branch information
ok-ryoko committed May 15, 2023
1 parent a7a62e2 commit ab8162b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crypto-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ pub trait KeyInit: KeySizeUser + Sized {
}
}

/// Types which can be initialized from a key and customization string, each of arbitrary length
pub trait KeyCustomInit: Sized {
/// Create new value from an arbitrary-length key and empty customization string
fn new_from_slice(key: &[u8]) -> Self {
Self::new_with_customization(key, &[])
}

/// Create new value from a key and customization string, each of arbitrary length
fn new_with_customization(key: &[u8], customization: &[u8]) -> Self;
}

/// Types which can be initialized from key and initialization vector (nonce).
pub trait KeyIvInit: KeySizeUser + IvSizeUser + Sized {
/// Create new value from fixed length key and nonce.
Expand Down

0 comments on commit ab8162b

Please sign in to comment.