MCPcopy
hub / github.com/EverythingSuckz/TG-FileStreamBot / Pack

Method Pack

internal/types/file.go:27–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25}
26
27func (f *HashableFileStruct) Pack() string {
28 hasher := md5.New()
29 val := reflect.ValueOf(*f)
30 for i := 0; i < val.NumField(); i++ {
31 field := val.Field(i)
32
33 var fieldValue []byte
34 switch field.Kind() {
35 case reflect.String:
36 fieldValue = []byte(field.String())
37 case reflect.Int64:
38 fieldValue = []byte(strconv.FormatInt(field.Int(), 10))
39 }
40
41 hasher.Write(fieldValue)
42 }
43 return hex.EncodeToString(hasher.Sum(nil))
44}

Callers 1

PackFileFunction · 0.80

Calls 2

StringMethod · 0.80
WriteMethod · 0.80

Tested by

no test coverage detected