pub fn verify(&self, key: &LicenseKey) -> Status {
        // Validate the checksum
        let checksum = key.calculate_checksum().to_vec();
        if checksum != key.get_checksum() {
            return Status::Invalid;
        }

        // Blocked key?
        let seed = key.get_seed();
        for blocked_seed in self.blocklist.iter() {
            if seed == *blocked_seed {
                return Status::Blocked;
            }
        }

        for check in self.checks.iter() {
            match key.get_byte(check.ordinal as usize) {
                Some(value) => {
                    if value != self.hasher.hash(seed, check.a, check.b, check.c) {
                        // Values did not match, but the checksum
                        // was correct, so this is a forged license key
                        return Status::Forged;
                    }
                }
                None => {
                    // If we couldn't get the byte from the license
                    // the license is invalid.
                    return Status::Invalid;
                }
            }
        }

        Status::Valid
    }
/// Perform verification on the provided license key.
Perform verification on the provided license key.
Perform verification on the provided license key .
pub fn verify(&self, key: &LicenseKey) -> Status {
        // Validate the checksum
        let checksum = key.calculate_checksum().to_vec();
        if checksum != key.get_checksum() {
            return Status::Invalid;
        }
        // Blocked key?
        let seed = key.get_seed();
        for blocked_seed in self.blocklist.iter() {
            if seed == *blocked_seed {
                return Status::Blocked;
            }
        }
        for check in self.checks.iter() {
            match key.get_byte(check.ordinal as usize) {
                Some(value) => {
                    if value != self.hasher.hash(seed, check.a, check.b, check.c) {
                        // Values did not match, but the checksum
                        // was correct, so this is a forged license key
                        return Status::Forged;
                    }
                }
                None => {
                    // If we couldn't get the byte from the license
                    // the license is invalid.
                    return Status::Invalid;
                }
            }
        }
        Status::Valid
    }
pub fn verify ( & self , key : & LicenseKey ) -> Status { // Validate the checksum let checksum = key . calculate_checksum ( ) . to_vec ( ) ; if checksum != key . get_checksum ( ) { return Status :: Invalid ; } // Blocked key? let seed = key . get_seed ( ) ; for blocked_seed in self . blocklist . iter ( ) { if seed == * blocked_seed { return Status :: Blocked ; } } for check in self . checks . iter ( ) { match key . get_byte ( check . ordinal as usize ) { Some ( value ) => { if value != self . hasher . hash ( seed , check . a , check . b , check . c ) { // Values did not match, but the checksum // was correct, so this is a forged license key return Status :: Forged ; } } None => { // If we couldn't get the byte from the license // the license is invalid. return Status :: Invalid ; } } } Status :: Valid }
Perform verification on the provided license key.
Perform verification on the provided license key .
&self
key
&LicenseKey
&self
key
&LicenseKey