pub fn add_hmac(&self, bundle: &mut Bundle) -> Result<()> {
        let mut curl = Curl::new(HashMode::CURLP27)?;
        for b in bundle.iter_mut() {
            if b.value > 0 {
                let bundle_hash_trits = b.bundle.trits();
                let mut hmac = [0; 243];
                curl.reset();
                curl.absorb(&self.key)?;
                curl.absorb(&bundle_hash_trits)?;
                curl.squeeze(&mut hmac)?;
                let hmac_trytes = hmac.trytes()?;
                b.signature_fragments = hmac_trytes
                    + &b.signature_fragments
                        .chars()
                        .skip(81)
                        .take(2106)
                        .collect::<String>();
            }
        }
        Ok(())
    }
/// Using the key provided earlier, add an HMAC to provided
/// Bundle
Using the key provided earlier, add an HMAC to provided
Bundle
Using the key provided earlier add an HMAC to provided Bundle
pub fn add_hmac(&self, bundle: &mut Bundle) -> Result<()> {
        let mut curl = Curl::new(HashMode::CURLP27)?;
        for b in bundle.iter_mut() {
            if b.value > 0 {
                let bundle_hash_trits = b.bundle.trits();
                let mut hmac = [0; 243];
                curl.reset();
                curl.absorb(&self.key)?;
                curl.absorb(&bundle_hash_trits)?;
                curl.squeeze(&mut hmac)?;
                let hmac_trytes = hmac.trytes()?;
                b.signature_fragments = hmac_trytes
                    + &b.signature_fragments
                        .chars()
                        .skip(81)
                        .take(2106)
                        .collect::<String>();
            }
        }
        Ok(())
    }
pub fn add_hmac ( & self , bundle : & mut Bundle ) -> Result < ( ) > { let mut curl = Curl :: new ( HashMode :: CURLP27 ) ? ; for b in bundle . iter_mut ( ) { if b . value > 0 { let bundle_hash_trits = b . bundle . trits ( ) ; let mut hmac = [ 0 ; 243 ] ; curl . reset ( ) ; curl . absorb ( & self . key ) ? ; curl . absorb ( & bundle_hash_trits ) ? ; curl . squeeze ( & mut hmac ) ? ; let hmac_trytes = hmac . trytes ( ) ? ; b . signature_fragments = hmac_trytes + & b . signature_fragments . chars ( ) . skip ( 81 ) . take ( 2106 ) . collect :: < String > ( ) ; } } Ok ( ( ) ) }
Using the key provided earlier, add an HMAC to provided
Bundle
Using the key provided earlier add an HMAC to provided Bundle
&self
bundle
&mut Bundle