// sanity checks the encrypted userpermit
// returns the different parts of the encrypted
sanity checks the encrypted userpermit
returns the different parts of the encrypted
sanity checks the encrypted userpermit returns the different parts of the encrypted
fn check_up_string(up: &str) -> Result<(&str, &str, &str), PermitErr> {
    validator(up, PERMIT_LENGTH)?;
    let (enc_hwid, chksum, id) = (&up[..16], &up[16..24], &up[24..]);
    let chksum_u32 = hex::decode(chksum)?
        .as_slice()
        .read_u32::<BigEndian>()
        .unwrap();
    if crc::crc32::checksum_ieee(enc_hwid.as_bytes()) != chksum_u32 {
        return Err(PermitErr::HashMisMatch);
    }
    Ok((enc_hwid, chksum, id))
}
fn check_up_string ( up : & str ) -> Result < ( & str , & str , & str ) , PermitErr > { validator ( up , PERMIT_LENGTH ) ? ; let ( enc_hwid , chksum , id ) = ( & up [ .. 16 ] , & up [ 16 .. 24 ] , & up [ 24 .. ] ) ; let chksum_u32 = hex :: decode ( chksum ) ? . as_slice ( ) . read_u32 :: < BigEndian > ( ) . unwrap ( ) ; if crc :: crc32 :: checksum_ieee ( enc_hwid . as_bytes ( ) ) != chksum_u32 { return Err ( PermitErr :: HashMisMatch ) ; } Ok ( ( enc_hwid , chksum , id ) ) }
sanity checks the encrypted userpermit
returns the different parts of the encrypted
sanity checks the encrypted userpermit returns the different parts of the encrypted
up
&str