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
Kevin Atkinson
5d8ad3eb9c
Create new Format interface for creating CIDs.
2018-06-28 22:48:56 -04:00
Steven Allen
63d4b33fcf
Add CID Prefix constructors.
...
One can now generate a CID by calling:
```go
cid.NewPrefixV1(cid.DagCBOR, mh.SHA_256).Sum(data)
```
Lots of code was already doing this by manually constructing CID Prefixes but
that tends to be a bit verbose and error prone.
2017-08-30 12:42:46 -07:00
Kevin Atkinson
f62e35b87a
Implement basic 'cid-fmt' utility.
...
Currently only implements printing the Cid prefix.
2017-08-15 03:46:48 -04:00
Herman Junge
7d345d4817
Switch from byte to uint64
2017-06-30 10:00:21 -04:00
Herman Junge
f6990413f7
Added map of string to codecs
2017-06-29 21:00:23 -04:00
Łukasz Magiera
b42583c8bf
Add StringOfBase function
2017-06-19 17:25:51 +02:00
Łukasz Magiera
d4ebfff511
Add git-raw code
2017-06-07 20:08:56 +02:00
Hector Sanjuan
7ef01bd895
Readme/golint: improve readme with gx instructions. Make golint happy.
...
License: MIT
Signed-off-by: Hector Sanjuan <hector@protocol.ai >
2017-03-24 15:12:07 +01:00
Jeromy
05ed406b31
add correct eth codes
2017-03-20 18:00:06 -07:00
Jeromy
92cac2f002
add an example to the tests to play around with the feature
2017-03-18 19:17:44 -07:00
Jeromy
7bcaf9264a
do cid json handling in this package
2017-02-05 23:52:06 -08:00
Jeromy
ebda3c73ae
actually update multihash package
2017-02-02 18:53:32 -08:00
Jeromy
f623f824db
fix build failures i introduced
2016-11-23 10:04:56 -08:00
Jeromy
1260e85a2d
fix raw codec number to be 0x55
2016-11-21 08:39:15 -08:00
Jakub Sztandera
ba97b640bd
Check length of copy to be extra sure we are copying whole thing
2016-11-17 19:24:12 +01:00
Jakub Sztandera
9116bf8025
Fix lengths in prefix too
2016-11-17 19:16:05 +01:00
Jakub Sztandera
9c3e314588
Use defined MaxVarintLen64 from stdlib
2016-11-17 19:01:33 +01:00