public static function hash($str, $salt = '', $plain = false)
    {
        $size = 512;
        $rounds = 1;
        if (strncmp($salt, '$', 1) === 0) {
            $e = explode('$', $salt, 3);
            $ee = explode('=', $e[1]);
            if (ctype_digit($ee[0])) {
                $size = (int)$e[1];
            }
            if (isset($ee[1]) && ctype_digit($e[1])) {
                $size = (int)$e[1];
            }
        }
        $hash = $str . $salt;
        if ($rounds < 1) {
            $rounds = 1;
        } elseif ($rounds > 128) {
            $rounds = 128;
        }
        for ($i = 0; $i < $rounds; ++$i) {
            $hash = \keccak_hash($hash, $size);
        }
        if ($plain) {
            return $hash;
        }
        return base64_encode($hash);
    }
public static function hash($str, $salt = '', $plain = false)
    {
        $size = 512;
        $rounds = 1;
        if (strncmp($salt, '$', 1) === 0) {
            $e = explode('$', $salt, 3);
            $ee = explode('=', $e[1]);
            if (ctype_digit($ee[0])) {
                $size = (int)$e[1];
            }
            if (isset($ee[1]) && ctype_digit($e[1])) {
                $size = (int)$e[1];
            }
        }
        $hash = $str . $salt;
        if ($rounds < 1) {
            $rounds = 1;
        } elseif ($rounds > 128) {
            $rounds = 128;
        }
        for ($i = 0; $i < $rounds; ++$i) {
            $hash = \keccak_hash($hash, $size);
        }
        if ($plain) {
            return $hash;
        }
        return base64_encode($hash);
    }
public static function hash ( $ str , $ salt = '' , $ plain = false ) { $ size = 512 ; $ rounds = 1 ; if ( strncmp ( $ salt , '$' , 1 ) === 0 ) { $ e = explode ( '$' , $ salt , 3 ) ; $ ee = explode ( '=' , $ e [ 1 ] ) ; if ( ctype_digit ( $ ee [ 0 ] ) ) { $ size = ( int ) $ e [ 1 ] ; } if ( isset ( $ ee [ 1 ] ) && ctype_digit ( $ e [ 1 ] ) ) { $ size = ( int ) $ e [ 1 ] ; } } $ hash = $ str . $ salt ; if ( $ rounds < 1 ) { $ rounds = 1 ; } elseif ( $ rounds > 128 ) { $ rounds = 128 ; } for ( $ i = 0 ; $ i < $ rounds ; ++ $ i ) { $ hash = \ keccak_hash ( $ hash , $ size ) ; } if ( $ plain ) { return $ hash ; } return base64_encode ( $ hash ) ; }
Generate keccak hash for string with salt
@param  string $str Data
@param  string $salt Salt
@param  boolean $plain Is plain text?
@return string
@deprecated
Generate keccak hash for string with salt