pub fn post_process_text_file_line(line: &mut String, integrity: &mut Option<Integrity>) {
    if let Some(integrity) = integrity {
        match integrity {
            Integrity::Crc32 => {
                let crc = crc32::checksum_ieee(line.as_bytes());
                *line += &format!(" {}", crc);
            },
            Integrity::Sha1Chain(prev_hash) => {
                let mut hash: [u8; 20] = [0; 20];
                blockchain_sha1(&prev_hash[..], line.as_bytes(), &mut hash);
                *line += &format!(" {}", hex::encode(&hash));
                *prev_hash = hash;
            },
            Integrity::Sha256Chain(prev_hash) => {
                let mut hash: [u8; 32] = [0; 32];
                blockchain_sha256(&prev_hash[..], line.as_bytes(), &mut hash);
                *line += &format!(" {}", hex::encode(&hash[..]));
                *prev_hash = hash;
            },
        }
    }

    line.push('\n');
}
/// Depending on the settings in 'cfg', it adds a checksum, calculates the blockchain, compresses, encrypts, etc.
Depending on the settings in 'cfg', it adds a checksum, calculates the blockchain, compresses, encrypts, etc.
Depending on the settings in ' cfg ' it adds a checksum calculates the blockchain compresses encrypts etc .
pub fn post_process_text_file_line(line: &mut String, integrity: &mut Option<Integrity>) {
    if let Some(integrity) = integrity {
        match integrity {
            Integrity::Crc32 => {
                let crc = crc32::checksum_ieee(line.as_bytes());
                *line += &format!(" {}", crc);
            },
            Integrity::Sha1Chain(prev_hash) => {
                let mut hash: [u8; 20] = [0; 20];
                blockchain_sha1(&prev_hash[..], line.as_bytes(), &mut hash);
                *line += &format!(" {}", hex::encode(&hash));
                *prev_hash = hash;
            },
            Integrity::Sha256Chain(prev_hash) => {
                let mut hash: [u8; 32] = [0; 32];
                blockchain_sha256(&prev_hash[..], line.as_bytes(), &mut hash);
                *line += &format!(" {}", hex::encode(&hash[..]));
                *prev_hash = hash;
            },
        }
    }
    line.push('\n');
}
pub fn post_process_text_file_line ( line : & mut String , integrity : & mut Option < Integrity > ) { if let Some ( integrity ) = integrity { match integrity { Integrity :: Crc32 => { let crc = crc32 :: checksum_ieee ( line . as_bytes ( ) ) ; * line += & format ! ( " " crc ) ; } , Integrity :: Sha1Chain ( prev_hash ) => { let mut hash : [ u8 ; 20 ] = [ 0 ; 20 ] ; blockchain_sha1 ( & prev_hash [ .. ] , line . as_bytes ( ) , & mut hash ) ; * line += & format ! ( " " hex encode ( hash ) ) ; * prev_hash = hash ; } , Integrity :: Sha256Chain ( prev_hash ) => { let mut hash : [ u8 ; 32 ] = [ 0 ; 32 ] ; blockchain_sha256 ( & prev_hash [ .. ] , line . as_bytes ( ) , & mut hash ) ; * line += & format ! ( " " hex encode ( hash [ ] ) ) ; * prev_hash = hash ; } , } } line . push ( '\n' ) ; }
Depending on the settings in 'cfg', it adds a checksum, calculates the blockchain, compresses, encrypts, etc.
Depending on the settings in ' cfg ' it adds a checksum calculates the blockchain compresses encrypts etc .
line
&mut String
integrity
&mut Option<Integrity>
line
&mut String
integrity
&mut Option<Integrity>