protected function uriToSha1($uri) { if (preg_match('#urn:(?:sha1|bitprint):([A-Z2-7]{32})\\b#', $uri, $bif)) { return TOGoS_Base32::decode($bif[1]); } else { // Well, if we have some datastore, we could go fetch the thing throw new Exception("Unrecognized SHA-1 URN: {$uri}"); } }
public function testDecoding() { foreach ($this->testIO as $in => $out) { $this->assertEquals($in, TOGoS_Base32::decode($out)); } }