elkrem: add method to export sender root

As noted in the comment on the method, this serialization method isn’t
strictly necessary assuming the root is derived via a cryptographically
secure, yet deterministic procedure. The method is supplied only for
convenience.
This commit is contained in:
Olaoluwa Osuntokun 2016-06-30 11:34:05 -07:00
parent 14f12fbb7d
commit 381474fc8e
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2
1 changed files with 7 additions and 0 deletions

View File

@ -121,3 +121,10 @@ func ElkremReceiverFromBytes(b []byte) (*ElkremReceiver, error) {
return &e, nil
}
// ToBytes returns the root of the elkrem sender tree as a byte slice. This
// function is in place to allow one to export the root of the tree. However,
// node that if one uses a deterministic procedure to generate the root, then
// serialization isn't necessary as it can simply be re-derived on the fly.
func (e *ElkremSender) ToBytes() []byte {
return e.root[:]
}