Skip to content

Commit

Permalink
Add PrfExpand<([u8; 32], [u8; 4])::with_tag (for tagged ZIP 32 child
Browse files Browse the repository at this point in the history
derivation).

Signed-off-by: Daira-Emma Hopwood <daira@jacaranda.org>
  • Loading branch information
daira committed Feb 12, 2025
1 parent 38e0772 commit 0f687c5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this library adheres to Rust's notion of
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- `PrfExpand<([u8; 32], [u8; 4])::with_tag` (for tagged ZIP 32 child derivation).

## [0.1.2] - 2024-10-01
### Added
Expand Down
6 changes: 6 additions & 0 deletions src/prf_expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ impl PrfExpand<([u8; 32], [u8; 4])> {
pub const SPROUT_ZIP32_CHILD: Self = Self::new(0x80);
pub const ORCHARD_ZIP32_CHILD: Self = Self::new(0x81);
pub const ARBITRARY_ZIP32_CHILD: Self = Self::new(0xAB);

/// Expands the given secret key in this domain, with an additional
/// `tag` input.
pub fn with_tag(self, c_par: &[u8], sk_par: &[u8; 32], i: &[u8; 4], tag: &[u8]) -> [u8; 64] {
self.apply(c_par, &[sk_par, i, tag])
}
}
impl PrfExpand<([u8; 32], [u8; 32])> {
pub const ORCHARD_DK_OVK: Self = Self::new(0x82);
Expand Down

0 comments on commit 0f687c5

Please sign in to comment.