netsec-ethz / rains

RAINS (Another Internet Naming Service)
Apache License 2.0
9 stars 11 forks source link

Change Hash function of types to use cbor #163

Closed fehlmach closed 5 years ago

fehlmach commented 5 years ago

Some types such as Assertions, Shards, etc. implement a hash method which is used as a key in the caches. Currently it is just a string representation of the type. Replace the string representation with the cbor representation if possible. You can use this code snippet:

var a *section.Assertion
encoding := new(bytes.Buffer)
if err := cbor.NewWriter(encoding).Marshal(a); err != nil {
    //handle error
}