MCPcopy Create free account
hub / github.com/aptly-dev/aptly / Hash

Method Hash

deb/package_files.go:60–74  ·  view source on GitHub ↗

Hash compute hash of all file items, sorting them first

()

Source from the content-addressed store, hash-verified

58
59// Hash compute hash of all file items, sorting them first
60func (files PackageFiles) Hash() uint64 {
61 sort.Sort(files)
62
63 h := fnv.New64a()
64
65 for _, f := range files {
66 h.Write([]byte(f.Filename))
67 _ = binary.Write(h, binary.BigEndian, f.Checksums.Size)
68 h.Write([]byte(f.Checksums.MD5))
69 h.Write([]byte(f.Checksums.SHA1))
70 h.Write([]byte(f.Checksums.SHA256))
71 }
72
73 return h.Sum64()
74}
75
76// Len returns number of files
77func (files PackageFiles) Len() int {

Callers

nothing calls this directly

Calls 1

WriteMethod · 0.65

Tested by

no test coverage detected