Kaynağa Gözat

Add some comments about the hash functions

Ian Goldberg 3 ay önce
ebeveyn
işleme
90f80136c2
2 değiştirilmiş dosya ile 8 ekleme ve 0 silme
  1. 6 0
      src/arctic.rs
  2. 2 0
      src/shine.rs

+ 6 - 0
src/arctic.rs

@@ -63,6 +63,8 @@ pub fn keygen(n: u32, t: u32) -> (PubKey, Vec<PubKey>, Vec<SecKey>) {
     (group_pubkey, player_pubkeys, seckeys)
 }
 
+// The hash function used to generate the value y that's the input to
+// shine::gen.
 fn hash2(pk: &PubKey, msg: &[u8]) -> [u8; 32] {
     let mut hash = Sha256::new();
     hash.update(pk.compress().as_bytes());
@@ -70,6 +72,10 @@ fn hash2(pk: &PubKey, msg: &[u8]) -> [u8; 32] {
     hash.finalize().into()
 }
 
+// The hash function that's used to generate the challenge c for the
+// Schnorr signature.  This function has to match the one for the
+// Schnorr verification implementation you're interoperating with, and
+// will depend on what group you're operating over.
 fn hash3(combcomm: &RistrettoPoint, pk: &PubKey, msg: &[u8]) -> Scalar {
     let mut hash = Sha256::new();
     hash.update(combcomm.compress().as_bytes());

+ 2 - 0
src/shine.rs

@@ -22,6 +22,8 @@ fn binom(m: u32, k: u32) -> u64 {
     numer / denom
 }
 
+// The hash function used to create the coefficients for the
+// pseudorandom secret sharing.
 fn hash1(phi: &[u8; 32], w: &[u8]) -> Scalar {
     let mut hash = Sha256::new();
     hash.update(phi);