コード例 #1
0
 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}");
     }
 }
コード例 #2
0
ファイル: Base32Test.php プロジェクト: TOGoS/PHPBase32
 public function testDecoding()
 {
     foreach ($this->testIO as $in => $out) {
         $this->assertEquals($in, TOGoS_Base32::decode($out));
     }
 }