Shuffle alphabet by given salt.

@param string $alphabet
@param string $salt

@return string
765267
protected function shuffle($alphabet, $salt)
    {
        $saltLength = strlen($salt);

        if (!$saltLength) {
            return $alphabet;
        }

        for ($i = strlen($alphabet) - 1, $v = 0, $p = 0; $i > 0; $i--, $v++) {
            $v %= $saltLength;
            $p += $int = ord($salt[$v]);
            $j = ($int + $v + $p) % $i;

            $temp = $alphabet[$j];
            $alphabet[$j] = $alphabet[$i];
            $alphabet[$i] = $temp;
        }

        return $alphabet;
    }
599408
protected function createSalt()
    {
        $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ./';
        $max = strlen($pool) - 1;
        $salt = '';
        for ($i = 0; $i < $this->saltLength; ++$i) {
            $salt .= $pool[random_int(0, $max)];
        }
        return $salt;
    }
430062
public static function shuffle($array, $seed = null)
    {
        if (is_null($seed)) {
            shuffle($array);
        } else {
            mt_srand($seed);
            shuffle($array);
            mt_srand();
        }

        return $array;
    }
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);
    }
507459
function (password, algorithm, salt) {
            salt = salt || Crypto.randomBytes(128).toString("hex");
            algorithm = algorithm || this.$.algorithm;

            var hash = Crypto.createHash(this.$.algorithm);
            hash.update(salt + password, "utf8");

            return [algorithm, salt, hash.digest("hex")].join(this.$.delimiter);
        }
822627
public static String generateSalt(int saltLength) {
		StringBuilder salt = new StringBuilder(saltLength);
		for (int i=0; i<saltLength; i++) {
			salt.append(CHAR_ARRAY[random.nextInt(CHAR_ARRAY.length)]);
		}
		return salt.toString();
	}
1273556
private function validateSaltLength(string $salt)
    {
        if (\mb_strlen($salt, '8bit') !== self::KEY_SALT_BYTE_LENGTH) {
            throw new InvalidArgumentException('Salt must be ' . self::KEY_SALT_BYTE_LENGTH . ' bytes long');
        }
    }
942336
public static function salt() {
        $alphabet = self::APRMD5_ALPHABET;
        $salt = '';
        for($i=0; $i<8; $i++) {
            $offset = hexdec(bin2hex(openssl_random_pseudo_bytes(1))) % 64;
            $salt .= $alphabet[$offset];
        }
        return $salt;
    }
137779
public function shuffle()
    {
        $keys = $this->getKeys();
        shuffle($keys);

        return $this->createFrom(array_replace(array_flip($keys), $this->toArray()));
    }
192818
def _decode(hashid, salt, alphabet, separators, guards):
    """"""
    parts = tuple(_split(hashid, guards))
    hashid = parts[1] if 2 <= len(parts) <= 3 else parts[0]

    if not hashid:
        return

    lottery_char = hashid[0]
    hashid = hashid[1:]

    hash_parts = _split(hashid, separators)
    for part in hash_parts:
        alphabet_salt = (lottery_char + salt + alphabet)[:len(alphabet)]
        alphabet = _reorder(alphabet, alphabet_salt)
        yield _unhash(part, alphabet)
1202593
public function genSalt($input = null)
    {
        if (!$input) {
            $input = $this->_getRandomBytes(12);
        }

        $identifier = $this->_identifier;

        $rounds = '';
        if ($this->_iterationCount != 5000) {
            $rounds = 'rounds=' . $this->_iterationCount . '$';
        }

        $salt = $this->_encode64($input, 12);

        return '$' . $identifier . '$' . $rounds . $salt . '$';
    }
231189
public function hash($password) {
        $salt = \ww_getSalt($this->saltLength);
        $hash = \ww_HashEncode($password.$salt);

        return $salt.'$'.$hash;
    }
996785
def _reorder(string, salt):
    """"""
    len_salt = len(salt)

    if len_salt != 0:
        string = list(string)
        index, integer_sum = 0, 0
        for i in range(len(string) - 1, 0, -1):
            integer = ord(salt[index])
            integer_sum += integer
            j = (integer + index + integer_sum) % i
            string[i], string[j] = string[j], string[i]
            index = (index + 1) % len_salt
        string = ''.join(string)

    return string
1310711
protected function _createSalt($length = 32)
    {
        static $chars ='qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM01234567890';

        $max  = strlen($chars) - 1;
        $salt = '';

        for ($i = 0; $i < $length; ++$i) {
            $salt .= $chars[(mt_rand(0, $max))];
        }

        return $salt;
    }
426890
public function setSalt(string $salt, string $position = self::SALT_AFTER): self
    {
        $this->checkSaltPositionArgument($position);
        $this->salt = $salt;
        $this->saltPosition = $position;

        return $this;
    }
540192
public function genSalt($input = null)
    {
        if (!$input) {
            $input = $this->_getRandomBytes(6);
        }

        $identifier = 'sha1';
        $salt = $this->_encode64($input, 6);

        return '$' . $identifier . '$' . $this->_iterationCount . '$' . $salt . '$';
    }
244016
public static function createSalt()
    {
        $alphabet = self::ALPHABET;
        $length = strlen($alphabet);
        $salt = [];
        for ($i = 0; $i < self::SALT_LENGTH; $i++) {
            $index = mt_rand(0, $length - 1);
            $salt[] = substr($alphabet, $index, 1);
        }
        return implode('', $salt);
    }