MCPcopy
hub / github.com/go-git/go-git / NewHasher

Function NewHasher

plumbing/hash.go:48–55  ·  view source on GitHub ↗
(t ObjectType, size int64)

Source from the content-addressed store, hash-verified

46}
47
48func NewHasher(t ObjectType, size int64) Hasher {
49 h := Hasher{hash.New(hash.CryptoType)}
50 h.Write(t.Bytes())
51 h.Write([]byte(" "))
52 h.Write([]byte(strconv.FormatInt(size, 10)))
53 h.Write([]byte{0})
54 return h
55}
56
57func (h Hasher) Sum() (hash Hash) {
58 copy(hash[:], h.Hash.Sum(nil))

Callers 10

TestRacyGitMethod · 0.92
TestZeroIndexModTimeMethod · 0.92
indexObjectsMethod · 0.92
patchDeltaWriterFunction · 0.92
prepareForReadMethod · 0.92
prepareForWriteMethod · 0.92
TestNewHasherMethod · 0.85
ComputeHashFunction · 0.85

Calls 3

NewFunction · 0.92
WriteMethod · 0.45
BytesMethod · 0.45

Tested by 3

TestRacyGitMethod · 0.74
TestZeroIndexModTimeMethod · 0.74
TestNewHasherMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…