pub fn deep_hash(&self, deep_hash_item: DeepHashItem) -> Result<[u8; 48], Error> {
        let hash = match deep_hash_item {
            DeepHashItem::Blob(blob) => {
                let blob_tag = format!("blob{}", blob.len());
                self.hash_all_sha384(vec![blob_tag.as_bytes(), &blob])?
            }
            DeepHashItem::List(list) => {
                let list_tag = format!("list{}", list.len());
                let mut hash = self.hash_sha384(list_tag.as_bytes())?;

                for child in list.into_iter() {
                    let child_hash = self.deep_hash(child)?;
                    hash = self.hash_sha384(&self.concat_u8_48(hash, child_hash)?)?;
                }
                hash
            }
        };
        Ok(hash)
    }
/// Calculates data root of transaction in accordance with implementation in [arweave-js](https://github.com/ArweaveTeam/arweave-js/blob/master/src/common/lib/deepHash.ts).
/// [`DeepHashItem`] is a recursive Enum that allows the function to be applied to
/// nested [`Vec<u8>`] of arbitrary depth.
Calculates data root of transaction in accordance with implementation in [arweave-js].
[`DeepHashItem`] is a recursive Enum that allows the function to be applied to
nested [`Vec`] of arbitrary depth.
Calculates data root of transaction in accordance with implementation in [ arweave - js ] . [ ` DeepHashItem ` ] is a recursive Enum that allows the function to be applied to nested [ ` Vec ` ] of arbitrary depth .
pub fn deep_hash(&self, deep_hash_item: DeepHashItem) -> Result<[u8; 48], Error> {
        let hash = match deep_hash_item {
            DeepHashItem::Blob(blob) => {
                let blob_tag = format!("blob{}", blob.len());
                self.hash_all_sha384(vec![blob_tag.as_bytes(), &blob])?
            }
            DeepHashItem::List(list) => {
                let list_tag = format!("list{}", list.len());
                let mut hash = self.hash_sha384(list_tag.as_bytes())?;
                for child in list.into_iter() {
                    let child_hash = self.deep_hash(child)?;
                    hash = self.hash_sha384(&self.concat_u8_48(hash, child_hash)?)?;
                }
                hash
            }
        };
        Ok(hash)
    }
pub fn deep_hash ( & self , deep_hash_item : DeepHashItem ) -> Result < [ u8 ; 48 ] , Error > { let hash = match deep_hash_item { DeepHashItem :: Blob ( blob ) => { let blob_tag = format ! ( " " blob len ( ) ) ; self . hash_all_sha384 ( vec ! [ blob_tag as_bytes ( ) blob ] ) ? } DeepHashItem :: List ( list ) => { let list_tag = format ! ( " " list len ( ) ) ; let mut hash = self . hash_sha384 ( list_tag . as_bytes ( ) ) ? ; for child in list . into_iter ( ) { let child_hash = self . deep_hash ( child ) ? ; hash = self . hash_sha384 ( & self . concat_u8_48 ( hash , child_hash ) ? ) ? ; } hash } } ; Ok ( hash ) }
Calculates data root of transaction in accordance with implementation in [arweave-js](https://github.com/ArweaveTeam/arweave-js/blob/master/src/common/lib/deepHash.ts).
Calculates data root of transaction in accordance with implementation in [ arweave - js ] ( https : // github . com / ArweaveTeam / arweave - js / blob / master / src / common / lib / deepHash . ts ) .
&self
deep_hash_item
DeepHashItem
&self
deep_hash_item
DeepHashItem