MCPcopy
hub / github.com/kopia/kopia / sha256Key

Function sha256Key

internal/bigmap/bigmap_internal_test.go:133–144  ·  view source on GitHub ↗
(h hash.Hash, out []byte, i int)

Source from the content-addressed store, hash-verified

131}
132
133func sha256Key(h hash.Hash, out []byte, i int) []byte {
134 var num [8]byte
135
136 // generate key=sha256(i) without allocations.
137 h.Reset()
138 binary.LittleEndian.PutUint64(num[:], uint64(i))
139 h.Write(num[:])
140
141 s := h.Sum(out)
142
143 return s
144}
145
146func BenchmarkInternalMap_NoValue(b *testing.B) {
147 ctx := testlogging.Context(b)

Callers 2

TestGrowingMapFunction · 0.70
TestGrowingSetFunction · 0.70

Calls 2

ResetMethod · 0.65
WriteMethod · 0.45

Tested by

no test coverage detected