PKPUsageStatsPlugin::_hashIp PHP Méthode

_hashIp() public méthode

NB: This implementation was taken from OA-S directly. See http://sourceforge.net/p/openaccessstati/code-0/3/tree/trunk/logfile-parser/lib/logutils.php We just do not implement the PHP4 part as OJS dropped PHP4 support.
public _hashIp ( $ip, $salt ) : string | boolean
$ip string
$salt string
Résultat string | boolean The hashed IP or boolean false if something went wrong.
    function _hashIp($ip, $salt)
    {
        if (function_exists('mhash')) {
            return bin2hex(mhash(MHASH_SHA256, $ip . $salt));
        } else {
            assert(function_exists('hash'));
            if (!function_exists('hash')) {
                return false;
            }
            return hash('sha256', $ip . $salt);
        }
    }