Get the password hashing context.
342217
def _get_pwd_context(self, app: FlaskUnchained) -> CryptContext:
        
        pw_hash = app.config.SECURITY_PASSWORD_HASH
        schemes = app.config.SECURITY_PASSWORD_SCHEMES
        if pw_hash not in schemes:
            allowed = (', '.join(schemes[:-1]) + ' and ' + schemes[-1])
            raise ValueError(f'Invalid password hashing scheme {pw_hash}. '
                             f'Allowed values are {allowed}.')
        return CryptContext(schemes=schemes, default=pw_hash,
                            deprecated=app.config.SECURITY_DEPRECATED_PASSWORD_SCHEMES)
410726
def get_context():
    
    pid = os.getpid()
    if pid not in context:
        context[pid] = zmq.Context()
        logger.debug('renewed context for PID %d', pid)
    return context[pid]
239257
def get_user_data_triplet(username, password):
    """"""
    context = SRPContext(username, password)
    username, password_verifier, salt = context.get_user_data_triplet(base64=True)

    click.secho('Username: %s' % username)
    click.secho('Password verifier: %s' % password_verifier)
    click.secho('Salt: %s' % salt)
251907
def password_hash(password, password_salt=None):
    """"""
    password_salt = password_salt or oz.settings["session_salt"]
    salted_password = password_salt + password
    return "sha256!%s" % hashlib.sha256(salted_password.encode("utf-8")).hexdigest()
845542
def password_hash(password):
    
    try:
        return bcrypt_sha256.encrypt(password)
    except TypeError:
        return bcrypt_sha256.encrypt(password.decode('utf-8'))
974364
def check_password(cls, instance, raw_password, enable_hash_migration=True):
        
        verified, replacement_hash = instance.passwordmanager.verify_and_update(
            raw_password, instance.user_password
        )
        if enable_hash_migration and replacement_hash:
            if six.PY2:
                instance.user_password = replacement_hash.decode("utf8")
            else:
                instance.user_password = replacement_hash
        return verified
706949
def check_old_password(pwdhash, password):
    
    from flask.ext.bcrypt import Bcrypt
    app.config['BCRYPT_LOG_ROUNDS'] = 12
    bcrypt = Bcrypt(app)
    return bcrypt.check_password_hash(pwdhash, password)
904761
def _get_credentials():
    '''
    
    '''
    ret = {
        'user': False,
        'passwd': False
    }

    # Loop through opts, grains, and pillar
    # Return the first acceptable configuration found
    for item in ret:
        for struct in [__opts__, __grains__, __pillar__]:
            # Look for the config key
            # Support old-style config format and new
            for config_key in __valid_configs[item]:
                value = salt.utils.data.traverse_dict_and_list(
                    struct,
                    config_key,
                    None)
                if value:
                    ret[item] = value
                    break
    return ret['user'], ret['passwd']
1003752
def hash_password(self, plain_password):
        """"""
        salt = uuid.uuid4().hex
        encrypted_password = self.get_hash(salt, plain_password)
        return salt + '$' + encrypted_password
973163
def _ask_password():
    """"""

    password = "Foo"
    password_trial = ""

    while password != password_trial:
        password = getpass.getpass()
        password_trial = getpass.getpass(prompt="Repeat:")
        if password != password_trial:
            print("\nPasswords do not match!")

    return password
567304
def get_user_password (self):
        
        if self.userinfo:
            # URL itself has authentication info
            return urllib.splitpasswd(self.userinfo)
        return self.aggregate.config.get_user_password(self.url)
623859
public static function getPasswordHash() {
        return new helpers_PasswordHash(
            defined('PASSWORD_HASH_ALGORITHM') ? PASSWORD_HASH_ALGORITHM : self::LEGACY_ALGORITHM,
            defined('PASSWORD_HASH_SALT_LENGTH') ? PASSWORD_HASH_SALT_LENGTH : self::LEGACY_SALT_LENGTH
        );
    }
978076
public static SecurityContext getSecurityContext() {
        Session session = ExecutionContext.getSession();
        @SuppressWarnings("resource")
        WebSocketSession ws = session == null ? null : session.getSocket();
        return ws == null ? null
                : (SecurityContext) ws.getAttributes().get(HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEY);
    }
1010930
def get_hash(self):
        
        if self._hash is None:
            self._hash = self._source.get_hash(self._handle).strip()
        return self._hash
1268678
def get(method, hmc, uri, uri_parms, logon_required):
        """"""
        query_str = uri_parms[0]
        try:
            console = hmc.consoles.lookup_by_oid(None)
        except KeyError:
            raise InvalidResourceError(method, uri)
        result_password_rules = []
        filter_args = parse_query_parms(method, uri, query_str)
        for password_rule in console.password_rules.list(filter_args):
            result_password_rule = {}
            for prop in password_rule.properties:
                if prop in ('element-uri', 'name', 'type'):
                    result_password_rule[prop] = password_rule.properties[prop]
            result_password_rules.append(result_password_rule)
        return {'password-rules': result_password_rules}
436291
def hash_password(self, password):
        
        if self.use_double_hash():
            password = self.get_hmac(password).decode('ascii')

        return self.security.pwd_context.hash(
            password,
            **current_app.config.SECURITY_PASSWORD_HASH_OPTIONS.get(
                current_app.config.SECURITY_PASSWORD_HASH, {}))
715975
def get_password_hash(username):
    
    try:
        h = spwd.getspnam(username)
    except KeyError:
        return None

    # mitogen.core.Secret() is a Unicode subclass with a repr() that hides the
    # secret data. This keeps secret stuff out of logs. Like blobs, secrets can
    # also be serialized.
    return mitogen.core.Secret(h)