Skip to content

Commit

Permalink
Merge pull request #90 from adityapk00/paperwallet
Browse files Browse the repository at this point in the history
Make some methods pub for use in External Wallet Generators

The exposed APIs may change in future crate versions.
  • Loading branch information
str4d authored Jul 22, 2019
2 parents 9e758dc + 7f60f0f commit 5a48d17
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions zcash_primitives/src/zip32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ struct ChainCode([u8; 32]);
pub struct DiversifierIndex(pub [u8; 11]);

impl DiversifierIndex {
fn new() -> Self {
pub fn new() -> Self {
DiversifierIndex([0; 11])
}

Expand All @@ -116,10 +116,10 @@ impl DiversifierIndex {

/// A key used to derive diversifiers for a particular child key
#[derive(Clone, Copy, Debug, PartialEq)]
struct DiversifierKey([u8; 32]);
pub struct DiversifierKey(pub [u8; 32]);

impl DiversifierKey {
fn master(sk_m: &[u8]) -> Self {
pub fn master(sk_m: &[u8]) -> Self {
let mut dk_m = [0u8; 32];
dk_m.copy_from_slice(&prf_expand(sk_m, &[0x10]).as_bytes()[..32]);
DiversifierKey(dk_m)
Expand All @@ -134,7 +134,7 @@ impl DiversifierKey {
/// Returns the first index starting from j that generates a valid
/// diversifier, along with the corresponding diversifier. Returns
/// an error if the diversifier space is exhausted.
fn diversifier(&self, mut j: DiversifierIndex) -> Result<(DiversifierIndex, Diversifier), ()> {
pub fn diversifier(&self, mut j: DiversifierIndex) -> Result<(DiversifierIndex, Diversifier), ()> {
let ff = FF1::<Aes256>::new(&self.0, 2).unwrap();
loop {
// Generate d_j
Expand Down

0 comments on commit 5a48d17

Please sign in to comment.