コード例 #1
0
 public function testHexDecodeGMP()
 {
     $cnt = (getenv('BITCOINLIB_EXTENSIVE_TESTING') ?: 1) * 100;
     // GMP has no real upper limit on the number of bytes!
     for ($i = 0; $i < $cnt; $i++) {
         $length = mt_rand(1, 5000);
         // Generate a random length hex string.
         $hex = (string) bin2hex(mcrypt_create_iv($length, \MCRYPT_DEV_URANDOM));
         // Get real decimal result.
         $dec = gmp_strval(gmp_init($hex, 16), 10);
         $this->assertEquals(BitcoinLib::hex_decode($hex), $dec);
     }
 }