ホームページ  >  記事  >  バックエンド開発  >  c#-php代码转C#代码,来个会PHP和C#的高手

c#-php代码转C#代码,来个会PHP和C#的高手

WBOY
WBOYオリジナル
2016-06-02 11:34:17998ブラウズ

phpc#

<code>public static function oath_hotp($key, $counter){   $bin_counter = pack('N*', 0) . pack('N*', $counter);     // Counter must be 64-bit int   $hash     = hash_hmac ('sha1', $bin_counter, $key, true);   return str_pad(self::oath_truncate($hash), self::otpLength, '0', STR_PAD_LEFT);}public static function oath_truncate($hash){   $offset = ord($hash[19]) & 0xf;   return (       ((ord($hash[$offset+0]) & 0x7f) </code>

self::otpLength是类中的一个变量

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。