Returns a boolean of whether the raw_password was correct. Handles
        hashing formats behind the scenes.
549731
def check_password(self, raw_password):
        
        def setter(raw_password):
            self.set_password(raw_password)
            self.save(update_fields=[self.PASSWORD_FIELD])
        return check_password(raw_password, getattr(self, self.PASSWORD_FIELD), setter)
727615
def verify(raw_body, key)
      _, plaintext, signature = parse(raw_body)
      key.public_key.verify(digest, signature, plaintext)
    rescue OStatus2::BadSalmonError
      false
    end
864332
def check(self, password: str) -> bool:
        
        return (
            pbkdf2_sha512.verify(password, self.password) or
            pbkdf2_sha512.verify(password,
                                 pbkdf2_sha512.encrypt(self.api_key))
        )
557435
def password_hash(pwd)
      hsh = 0
      pwd.reverse.each_char { |c|
        hsh = hsh ^ c.ord
        hsh = hsh << 1
        hsh -= 0x7fff if hsh > 0x7fff
      }

      (hsh ^ pwd.length ^ 0xCE4B).to_s(16)
    end
240180
def is_common_password(raw, freq=0):
    
    frequent = WORDS.get(raw, 0)
    if freq:
        return frequent > freq
    return bool(frequent)
455283
def _hashed_key(self):
        
        return abs(int(hashlib.md5(
            self.key_prefix.encode('utf8')
        ).hexdigest(), 16)) % (10 ** (
            self._size_mod if hasattr(self, '_size_mod') else 5))
687118
def ValidatePassword(self, password):
        
        password = to_aes_key(password)
        return hashlib.sha256(password).digest() == self.LoadStoredData('PasswordHash')
140579
def decode(self, data, password):
		
		self.raw = gntp.shim.u(data)
		parts = self.raw.split('\r\n\r\n')
		self.info = self._parse_info(self.raw)
		self._validate_password(password)
		self.headers = self._parse_dict(parts[0])

		for i, part in enumerate(parts):
			if i == 0:
				continue  # Skip Header
			if part.strip() == '':
				continue
			notice = self._parse_dict(part)
			if notice.get('Notification-Name', False):
				self.notifications.append(notice)
			elif notice.get('Identifier', False):
				notice['Data'] = self._decode_binary(part, notice)
				#open('register.png','wblol').write(notice['Data'])
				self.resources[notice.get('Identifier')] = notice
1150806
public static boolean check(String passwd, String hashed) {
        try {
            String[] parts = hashed.split("\\$");

            if (parts.length != 5 || !parts[1].equals("s0")) {
                throw new IllegalArgumentException("Invalid hashed value");
            }

            long params = Long.parseLong(parts[2], 16);
            byte[] salt = decode(parts[3].toCharArray());
            byte[] derived0 = decode(parts[4].toCharArray());

            int N = (int) Math.pow(2, params >> 16 & 0xffff);
            int r = (int) params >> 8 & 0xff;
            int p = (int) params      & 0xff;

            byte[] derived1 = SCrypt.scrypt(passwd.getBytes("UTF-8"), salt, N, r, p, 32);

            if (derived0.length != derived1.length) return false;

            int result = 0;
            for (int i = 0; i < derived0.length; i++) {
                result |= derived0[i] ^ derived1[i];
            }
            return result == 0;
        } catch (UnsupportedEncodingException e) {
            throw new IllegalStateException("JVM doesn't support UTF-8?");
        } catch (GeneralSecurityException e) {
            throw new IllegalStateException("JVM doesn't support SHA1PRNG or HMAC_SHA256?");
        }
    }
836324
def verify(password_hash, password):
    
    if password_hash.startswith(argon2id.STRPREFIX):
        return argon2id.verify(password_hash, password)
    elif password_hash.startswith(argon2i.STRPREFIX):
        return argon2id.verify(password_hash, password)
    elif password_hash.startswith(scrypt.STRPREFIX):
        return scrypt.verify(password_hash, password)
    else:
        raise(CryptPrefixError("given password_hash is not "
                               "in a supported format"
                               )
              )
664106
def check_password(password)
    return false unless key
    key == self.class.hash_password(password, key.split('|', 2).first)
  end
42631
def is_valid_image(self, raw_data):
        
        buf = StringIO(raw_data)
        try:
            trial_image = Image.open(buf)
            trial_image.verify()
        except Exception:
            # TODO: Get more specific with this exception handling.
            return False
        return True
995345
def bcrypt_set_password(self, raw_password):
    
    if not is_enabled() or raw_password is None:
        _set_password(self, raw_password)
    else:
        salt = bcrypt.gensalt(get_rounds())
        self.password = 'bc$' + bcrypt.hashpw(smart_str(raw_password), salt)
292592
protected function ensureHashedPassword() {
    // the password is expected to be stored in the 'password' value
    $password = $this->getValue('password');
    if (strlen($password) > 0 && !PasswordService::isHashed($password)) {
      $this->setValue('password', PasswordService::hash($password));
    }
  }
644358
def RawBytesToScriptHash(raw):
        
        rawh = binascii.unhexlify(raw)
        rawhashstr = binascii.unhexlify(bytes(Crypto.Hash160(rawh), encoding='utf-8'))
        return UInt160(data=rawhashstr)
775938
def sha256_fingerprint_from_raw_ssh_pub_key(raw_key):
    
    digest = hashlib.sha256(raw_key).digest()
    h = base64.b64encode(digest).decode('utf-8')
    h = h.rstrip().rstrip('=')  # drop newline and possible base64 padding
    return 'SHA256:' + h
1104354
def decrypt(self, password_encrypted):
        
        if not password_encrypted or not self._crypter:
            return password_encrypted or b''
        return self._crypter.decrypt(password_encrypted)