Hash links

This commit is contained in:
Richard Patel
2018-11-06 02:01:53 +01:00
parent ed5e35f005
commit a8c27b2d21
2 changed files with 14 additions and 4 deletions

View File

@@ -156,6 +156,14 @@ func (f *File) HashDir(links []fasturl.URL) (o redblackhash.Key) {
return
}
func HashString(s string) (o redblackhash.Key) {
h, _ := blake2b.New256(nil)
h.Write([]byte(s))
sum := h.Sum(nil)
copy(o[:redblackhash.KeySize], sum)
return
}
func (f *File) ParseHeader(h []byte) {
var k1, k2 int
var v1, v2 int