MCPcopy
hub / github.com/rclone/rclone / stringToHash

Function stringToHash

cmd/bisync/bisync_test.go:1967–1984  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

1965}
1966
1967func stringToHash(s string) string {
1968 ht := hash.MD5
1969 hasher, err := hash.NewMultiHasherTypes(hash.NewHashSet(ht))
1970 if err != nil {
1971 fs.Errorf(s, "hash unsupported: %v", err)
1972 }
1973
1974 _, err = hasher.Write([]byte(s))
1975 if err != nil {
1976 fs.Errorf(s, "failed to write to hasher: %v", err)
1977 }
1978
1979 sum, err := hasher.SumString(ht, false)
1980 if err != nil {
1981 fs.Errorf(s, "hasher returned an error: %v", err)
1982 }
1983 return sum
1984}
1985
1986func detectEncoding(s string) string {
1987 if norm.NFC.IsNormalString(s) && norm.NFD.IsNormalString(s) {

Callers 2

runTestStepMethod · 0.85
listSubdirsMethod · 0.85

Calls 5

NewMultiHasherTypesFunction · 0.92
NewHashSetFunction · 0.92
ErrorfFunction · 0.92
SumStringMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…