Change-Id: Ib9092286e351cc7f488c414222478318a2ffbc76
This commit is contained in:
qiulaidongfeng 2024-09-24 21:09:26 +08:00
parent f4ae01e02e
commit 6dccae260b
No known key found for this signature in database
1 changed files with 6 additions and 0 deletions

View File

@ -339,8 +339,14 @@ func appendT(h *Hash, v reflect.Value) {
h.WriteString(v.String())
return
case reflect.Struct:
var buf [8]byte
for i := range v.NumField() {
f := v.Field(i)
byteorder.LePutUint64(buf[:], uint64(i))
// do not want to hash to the same value,
// struct{a,b string}{"foo",""} and
// struct{a,b string}{"","foo"}.
h.Write(buf[:])
appendT(h, f)
}
return