MCPcopy Create free account
hub / github.com/BitVM/BitVM / secret_key_for_digit

Function secret_key_for_digit

bitvm/src/signatures/winternitz.rs:69–76  ·  view source on GitHub ↗

Returns the secret key for given digit, appending the representation of it in bigger endian bytes to the message secret key

(secret_key: &SecretKey, mut digit_index: u32)

Source from the content-addressed store, hash-verified

67
68/// Returns the secret key for given digit, appending the representation of it in bigger endian bytes to the message secret key
69pub fn secret_key_for_digit(secret_key: &SecretKey, mut digit_index: u32) -> hash160::Hash {
70 let mut secret_i = secret_key.clone();
71 while digit_index > 0 {
72 secret_i.push((digit_index & 255) as u8);
73 digit_index >>= 8;
74 }
75 hash160::Hash::hash(&secret_i)
76}
77
78/// Returns the signature of a given digit, requires the digit index to modify the secret key for each digit
79pub fn digit_signature(secret_key: &SecretKey, digit_index: u32, message_digit: u32) -> HashOut {

Callers 2

digit_signatureFunction · 0.85
public_key_for_digitFunction · 0.85

Calls 2

cloneMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected