public static function sslKeyPubFingerprintVerify($fingerprint) { if (substr($fingerprint, 0, 3) == 'FC_') { $fingerprint = substr($fingerprint, 3); #$fingerprintNum = Base58::decode($fingerprint); $base58 = new Base58(); $fingerprintNum = $base58->decode((string) $fingerprint); $fingerprintHex = Hex::encode($fingerprintNum); $fingerprintHex = str_repeat('0', strlen($fingerprintHex) % 2) . $fingerprintHex; $checksumHex = substr($fingerprintHex, -8); $fingerprintHex = substr($fingerprintHex, 0, -8); $fingerprintBin = Hex::dataDecode($fingerprintHex); $fingerprintBinChecksumHex = substr(hash('sha512', hash('sha512', $fingerprintBin, true)), 0, 8); return $checksumHex == $fingerprintBinChecksumHex; } return false; }
/** * @expectedException InvalidArgumentException * @expectedExceptionCode 1 */ public function testDataDecodeInvalidArgumentException() { Hex::dataDecode('a41'); }