in signature/php/src/SignatureUtil.php [97:110]
private static function hmac_sm3($data, $key, $raw_output = false)
{
$pack = 'H' . \strlen(self::sm3('test'));
$blocksize = 64;
if (\strlen($key) > $blocksize) {
$key = pack($pack, self::sm3($key));
}
$key = str_pad($key, $blocksize, \chr(0x00));
$ipad = $key ^ str_repeat(\chr(0x36), $blocksize);
$opad = $key ^ str_repeat(\chr(0x5C), $blocksize);
$hmac = self::sm3($opad . pack($pack, self::sm3($ipad . $data)));
return $raw_output ? pack($pack, $hmac) : $hmac;
}