use string instead of []byte as underlying store

This commit is contained in:
dignifiedquire
2018-05-03 19:26:57 +02:00
committed by Kevin Atkinson
parent e153340e5a
commit 92496b5494
3 changed files with 32 additions and 28 deletions

View File

@@ -36,7 +36,7 @@ func (p Prefix) WithCodec(c uint64) Builder {
func (p V0Builder) Sum(data []byte) (Cid, error) {
hash, err := mh.Sum(data, mh.SHA2_256, -1)
if err != nil {
return nil, err
return EmptyCid, err
}
return NewCidV0(hash), nil
}
@@ -59,7 +59,7 @@ func (p V1Builder) Sum(data []byte) (Cid, error) {
}
hash, err := mh.Sum(data, p.MhType, mhLen)
if err != nil {
return nil, err
return EmptyCid, err
}
return NewCidV1(p.Codec, hash), nil
}