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

Function sha256Key

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

Source from the content-addressed store, hash-verified

58}
59
60func sha256Key(h hash.Hash, out []byte, i int) []byte {
61 var num [8]byte
62
63 // generate key=sha256(i) without allocations.
64 h.Reset()
65 binary.LittleEndian.PutUint64(num[:], uint64(i))
66 h.Write(num[:])
67
68 s := h.Sum(out)
69
70 return s
71}
72
73func BenchmarkMap_NoValue(b *testing.B) {
74 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