Hash a plain string with the salt and call the callback.
@param  {String}   plain_text to hash.
@param  {String}   salt to use during hash process.
@param  {Function} callback to execute with the new password.
@return {void}
13773
function hash_password(plain_text, salt, callback) {
  // Get the crypto library.
  const crypto = require("crypto")

  // These should be a *slow* as possible, higher = slower.
  // Slow it down until you tweak a bounce change.
  const password_iterations = process.env.PW_GEN_PW_ITERS || 4096

  // Password length and algorithm.
  const password_length = process.env.PW_GEN_PW_LENGTH || 512
  const password_algorithm = process.env.PW_GEN_PW_ALG || "sha256"

  // Create a hash, we're going to encrypt the password.
  // I wish Node had native support for good KDF functions
  // like bcrypt or scrypt but PBKDF2 is good for now.
  crypto.pbkdf2(plain_text, salt, password_iterations, password_length, password_algorithm, (err, key) => {
    // Move on.
    callback(key.toString("hex"), salt)
  })
}
203556
function makePasswordHash(password, cb) {
	try {
		const hash = hashes.create(exports.getHashConfiguration());
		hash.fill(password, function (error) {
			cb(error, hash);
		});
	} catch (error) {
		return cb(error);
	}
}
1131988
def use_double_hash(self, password_hash=None):
        
        single_hash = current_app.config.SECURITY_PASSWORD_SINGLE_HASH
        if single_hash and self.security.password_salt:
            raise RuntimeError('You may not specify a salt with '
                               'SECURITY_PASSWORD_SINGLE_HASH')

        if password_hash is None:
            is_plaintext = self.security.password_hash == 'plaintext'
        else:
            is_plaintext = \
                self.security.pwd_context.identify(password_hash) == 'plaintext'

        return not (is_plaintext or single_hash)
798867
function hash($pw,$salt=NULL,$cost=self::COST) {
		if ($cost<4 || $cost>31)
			user_error(self::E_CostArg,E_USER_ERROR);
		$len=22;
		if ($salt) {
			if (!preg_match('/^[[:alnum:]\.\/]{'.$len.',}$/',$salt))
				user_error(self::E_SaltArg,E_USER_ERROR);
		}
		else {
			$raw=16;
			$iv='';
			if (!$iv && extension_loaded('openssl'))
				$iv=openssl_random_pseudo_bytes($raw);
			if (!$iv)
				for ($i=0;$i<$raw;$i++)
					$iv.=chr(mt_rand(0,255));
			$salt=str_replace('+','.',base64_encode($iv));
		}
		$salt=substr($salt,0,$len);
		$hash=crypt($pw,sprintf('$2y$%02d$',$cost).$salt);
		return strlen($hash)>13?$hash:FALSE;
	}
613767
public static function hmac(string $text, string $salt, string $format = null): string
    {
        $format = $format ?? self::$format;

        if (self::FORMAT_HEX === $format) {
            return \hash_hmac(self::HASH_TYPE, $text, $salt, false);
        }

        $raw = \hash_hmac(self::HASH_TYPE, $text, $salt, true);

        return self::fromRaw($raw, $format);
    }
616245
function(callback) {
			var query = this.toQuery();
			var idx = 0;
			while (query.args.length > 0) {
				var value = query.args.shift();
				query.text = query.text.replace(/\?/,callback(value,idx));
				idx++;
			}
			return query.text;
		}
1339995
def hash_token(token, salt):
    '''
    
    '''
    digest = hashes.Hash(sha(), backend=default_backend())
    digest.update(binascii.unhexlify(token))
    digest.update(binascii.unhexlify(salt))
    return binascii.hexlify(digest.finalize()).decode()
850900
function hash_verify (password, _hash) {
  let hash = _hash.split('|')
  switch (hash[1]) {
    case 'bcrypt':
      return bcrypt_compare(password, hash[0])
    default:
      return Promise.resolve(password === hash[0])
  }
}
198135
function encrypt(salt, password) {
    var hash = crypto.createHash('sha256').update(salt + password).digest('base64');
    return salt + hash;
}
823034
function (password, salt) {
            // Shortcut
            var cfg = this.cfg;

            // Init hasher
            var hasher = cfg.hasher.create();

            // Initial values
            var derivedKey = WordArray.create();

            // Shortcuts
            var derivedKeyWords = derivedKey.words;
            var keySize = cfg.keySize;
            var iterations = cfg.iterations;

            // Generate key
            while (derivedKeyWords.length < keySize) {
                if (block) {
                    hasher.update(block);
                }
                var block = hasher.update(password).finalize(salt);
                hasher.reset();

                // Iterations
                for (var i = 1; i < iterations; i++) {
                    block = hasher.finalize(block);
                    hasher.reset();
                }

                derivedKey.concat(block);
            }
            derivedKey.sigBytes = keySize * 4;

            return derivedKey;
        }
1006971
function(password) {
      // empty password not allowed
      if (password) {
        var hmac = forge.hmac.create();
        hmac.start('sha256', SECRET);
        hmac.update(password);
        this._password = password;
        this._passwordHash = hmac.digest().toHex();
      }
    }
1191821
public static String createHash(char[] password) throws NoSuchAlgorithmException, InvalidKeySpecException {

    final SecureRandom random = new SecureRandom();
    final byte[] salt = new byte[SALT_BYTES];
    random.nextBytes(salt);

    final byte[] hash = pbkdf2(password, salt, PBKDF2_ITERATIONS, HASH_BYTES);
    // format iterations:salt:hash
    return PBKDF2_ITERATIONS + ":" + toHex(salt) + ":" + toHex(hash);
  }
956615
def _passphrase_callback(passphrase):
    '''
    
    '''
    def f(*args):
        return salt.utils.stringutils.to_bytes(passphrase)
    return f
653310
function hash(token, base) {
  var text = token.text;
  text = gfm(text);
  return (base || '') + '#' + text;
}
445341
function genSalt(opts, cb) {
    crypto.randomBytes(saltLength, function(err, buf) {
      opts.salt = buf;
      cb(err, opts);
    });
  }
1003752
def hash_password(self, plain_password):
        """"""
        salt = uuid.uuid4().hex
        encrypted_password = self.get_hash(salt, plain_password)
        return salt + '$' + encrypted_password
858847
async def _send_plain_text(self, request: Request, stack: Stack):
        

        await self._send_text(request, stack, None)