Skip to content

Commit

Permalink
Update CID.php
Browse files Browse the repository at this point in the history
  • Loading branch information
kawax committed Dec 15, 2024
1 parent 8e18e95 commit 24aba26
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Support/CID.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class CID
*
* ```
* CIDv1
* multi codec: raw
* multi codec: RAW or DAG-CBOR
* multi hash: sha256
* ```
*/
Expand All @@ -40,10 +40,10 @@ public static function encode(string $data, int $codec = self::RAW): string

$version = Varint::encode(self::CID_V1);
$code = Varint::encode($codec);
$type = Varint::encode(self::SHA2_256);
$algo = Varint::encode(self::SHA2_256);
$length = Varint::encode($hash_length);

$bytes = $version.$code.$type.$length.$hash;
$bytes = $version.$code.$algo.$length.$hash;

return Multibase::encode(Multibase::BASE32, $bytes);
}
Expand Down

0 comments on commit 24aba26

Please sign in to comment.