public static function hash()

in encode/php/src/EncodeUtil.php [89:105]


    public static function hash($raw, $algorithm)
    {
        if (empty($raw) || empty($algorithm)) {
            return null;
        }

        $str = Utils::toString($raw);

        if (false !== strpos($algorithm, 'HMAC-SHA256') || false !== strpos($algorithm, 'RSA-SHA256')) {
            $res = hash('sha256', $str, true);
            return Utils::toBytes($res);
        } else if (false !== strpos($algorithm, 'HMAC-SM3')) {
            $res = self::sm3($str);
            return Utils::toBytes(hex2bin($res));
        }
        return null;
    }