Cleanup of remaing extension hashing

extension hashing is now accurate across the v2 and v3 low level models.
This commit is contained in:
Dave Shanley
2022-11-11 11:20:51 -05:00
parent 61f99b8fd6
commit 94aabf4928
20 changed files with 163 additions and 44 deletions

View File

@@ -150,9 +150,13 @@ func (p *Paths) Hash() [32]byte {
for k := range l {
f = append(f, low.GenerateHashString(keys[l[k]].Value))
}
ekeys := make([]string, len(p.Extensions))
z = 0
for k := range p.Extensions {
f = append(f, fmt.Sprintf("%s-%x", k.Value,
sha256.Sum256([]byte(fmt.Sprint(p.Extensions[k].Value)))))
ekeys[z] = fmt.Sprintf("%s-%x", k.Value, sha256.Sum256([]byte(fmt.Sprint(p.Extensions[k].Value))))
z++
}
sort.Strings(ekeys)
f = append(f, ekeys...)
return sha256.Sum256([]byte(strings.Join(f, "|")))
}