gammazero
0ca2bbaeb3
Add SumStream to read data from io.Reader
...
This provides a way to create a CID without having to read all data into memory before passing it into Sum. Instead, call SumStream passing in an io.Reader.
2021-04-07 12:45:16 -07:00
Alex Good
de49849130
Add the dagjose multiformat
2020-10-15 14:00:36 +11:00
Steven Allen
f7cb4c91eb
feat: optimize cid.Prefix
...
We call this frequently and having to allocate here is really unfortunate.
2020-07-22 19:45:20 -07:00
Rod Vagg
8dd6fe2778
feat: add Filecoin multicodecs
...
* fil-commitment-unsealed
* fil-commitment-sealed
Ref: https://github.com/multiformats/multicodec/pull/161
Ref: https://github.com/multiformats/multicodec/pull/172
2020-05-13 11:22:42 +10:00
Jeromy
75caa6bdbd
avoid calling the method WriteTo if we don't satisfy its contract
2020-05-01 16:04:36 -07:00
Eric Myhre
628a0123ed
Slightly more documentation comment.
2020-05-02 00:52:07 +02:00
Jeromy
266e76d591
properly satisfy writerTo interface
2020-05-01 15:44:06 -07:00
Jeromy
7d7cb88d78
add a couple useful methods
2020-05-01 15:01:28 -07:00
Volker Mische
9cb3848e51
chore: make comment reflect the code
...
During the change to default CIDV1 to Base32, the corresponding code
comment wasn't updated.
2020-04-28 16:02:21 +02:00
Steven Allen
c1b740035a
fix: enforce minimal encoding
...
Note: this removes two errors that don't appear to be used by anyone.
2020-02-03 20:55:45 -08:00
Steven Allen
60ab0f84f0
chore: avoid magic numbers
2019-12-02 20:35:36 -05:00
Steven Allen
08e15f8a6c
chore: avoid re-validated already validated CIDs
2019-12-02 20:35:27 -05:00
Steven Allen
58b483a841
fix: avoid panicing if we try to parse a non-sha multihash as a CIDv0
...
I'm pretty sure we never call `Parse` multihashes anyways, but we should be careful.
2019-12-02 20:34:30 -05:00
Whyrusleeping
79e75dffeb
Merge pull request #95 from ipfs/feat/cid-from-bytes
...
Add a function to read a cid from an array of bytes
2019-11-12 10:17:18 +09:00
whyrusleeping
cf8cf8856e
Use optimized multihash method for parsing
2019-11-11 16:33:49 -08:00
Jakub Sztandera
9238d1a533
Verify that prefix is correct v0 prefix
...
License: MIT
Signed-off-by: Jakub Sztandera <kubuxu@protocol.ai >
2019-11-11 20:00:31 +01:00
whyrusleeping
16bbe1cf14
Add a command to read a cid from an array of bytes
2019-11-10 22:17:41 -08:00
Marcin Rataj
3f1777738f
Add libp2p-key multicodec
...
Context: https://github.com/multiformats/multicodec/issues/130
License: MIT
Signed-off-by: Marcin Rataj <lidel@lidel.org >
2019-05-28 01:40:54 +02:00
Steven Allen
f04f9216e7
default cidv1 to base32
2019-05-06 16:22:17 -07:00
Steven Allen
cf3b4efcaf
fix inline CIDs generated by Prefix.Sum
2019-02-20 19:06:04 -08:00
Hector Sanjuan
00439572fb
Let Cid implement Binary[Un]Marshaler and Text[Un]Marshaler interfaces.
...
This makes Cid implement https://golang.org/pkg/encoding/#BinaryMarshaler
which is used by go-codec to decide if things know how to serialize themselves
(currently we need do manual wrapping for anything containing a CID).
Since I was at it, I did the TextMarshaling one too.
2019-02-19 16:41:30 +00:00
Madper Xie
e6d04f280e
fix typo in comment
2019-02-15 20:19:46 +08:00
Samuel Li
628ab3426c
add codecs for Dash blocks, tx
2018-10-07 11:21:41 -07:00
Kevin Atkinson
dfc48d3ec4
Make sure we have a SHA2_256, length 32 hash when creating a CidV0.
2018-09-11 19:17:40 -04:00
Kevin Atkinson
46dd393ad1
Handel undefined Cid is JSON representation.
2018-09-07 14:03:03 -04:00
Kevin Atkinson
67a2bcf7e7
Change 'Nil' constant to 'Undef'.
2018-09-05 15:43:18 -04:00
Kevin Atkinson
643f78a8f9
Change 'IsNil' method to 'Defined'.
2018-09-05 03:26:26 -04:00
Kevin Atkinson
440a1c1a5a
Removed description of layout of CID as it is not correct for CIDv0.
2018-08-31 00:35:55 -04:00
Kevin Atkinson
e0a5698af9
Add IsNil() method.
2018-08-31 00:35:54 -04:00
Kevin Atkinson
667c6a9418
Avoid allocating memory in Type() method.
2018-08-31 00:35:53 -04:00
Kevin Atkinson
426ebe9e55
Simplify assignment in UnmarshalJSON.
2018-08-31 00:35:52 -04:00
Kevin Atkinson
cad52160a4
Ensure we always have a valid Cid by hiding the type in a struct.
2018-08-31 00:35:51 -04:00
Kevin Atkinson
b5a08dcaaa
Change EmptyCid to just Nil.
2018-08-31 00:35:51 -04:00
Kevin Atkinson
9831436a6f
Change string representation to represent actual binary representation.
2018-08-31 00:35:47 -04:00
Kevin Atkinson
d7974d2277
Export version() method, various other code cleanups.
2018-08-31 00:34:19 -04:00
dignifiedquire
8009448a20
fix KeyString()
2018-08-31 00:34:03 -04:00
dignifiedquire
92496b5494
use string instead of []byte as underlying store
2018-08-31 00:34:02 -04:00
dignifiedquire
e153340e5a
feat: use CIDs as their byte representation instead of a struct
2018-08-31 00:33:47 -04:00
Kevin Atkinson
b3d85b3dee
Enhance documentation for Encode method.
2018-08-30 00:38:17 -04:00
Kevin Atkinson
9091e50b29
Rename Format method to Encode.
2018-08-30 00:30:14 -04:00
Kevin Atkinson
a0b3b11e63
Create a new Format method that is like StringOfBase but never errors
2018-08-30 00:30:14 -04:00
Kevin Atkinson
a8ae38caae
Merge pull request #61 from ipfs/kevina/cid-fmt-enhan
...
cid-fmt Enhancments
2018-08-10 17:35:25 -04:00
Kevin Atkinson
23f03cb301
Merge pull request #53 from ipfs/kevina/format
...
Create new Builder interface for creating CIDs.
2018-08-10 17:34:56 -04:00
Kevin Atkinson
0f09109d9f
Replace DecodeV2 with ExtractEncoding
2018-08-09 02:37:09 -04:00
Kevin Atkinson
67951e2c09
Move deprecated function to there own file.
2018-08-09 00:15:04 -04:00
Kevin Atkinson
ad88cb11c5
Rename Format to Builder.
2018-08-09 00:15:04 -04:00
Kevin Atkinson
c4bfcd0671
Extract most of cid-fmt logic so it can be used as a library.
2018-08-01 04:21:32 -04:00
Hector Sanjuan
8028fee095
Add Decred codecs
...
0xe0 and 0xe1 have been assigned to Decred block and tx in the
multicodecs table. https://github.com/multiformats/multicodec/pull/78
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai >
2018-07-23 19:28:53 +02:00
Fritz Schneider
9cb0b7bcae
use value receiver
2018-07-11 11:20:53 -10:00
Kevin Atkinson
6f951560f5
Update deprecated note to reflect code review.
2018-06-28 23:08:17 -04:00