File size: 340 Bytes
4951e76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
pub fn split_hash_salt_len(hash: &[u8]) -> Result<usize, u8> {
    if hash.len() != 60 {
        return Err(1);
    }
    let mut ascii = true;
    let mut i = 0usize;
    while i < hash.len() {
        if hash[i] >= 128 {
            ascii = false;
        }
        i += 1;
    }
    if !ascii {
        return Err(2);
    }
    Ok(22)
}