/** * @expectedException InvalidArgumentException * @expectedExceptionMessage Argument $base58 contains invalid characters. */ public function testInvalidBase58() { $base58 = new Base58(); $base58->decode("This isn't valid base58"); }
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; }