MCPcopy
hub / github.com/nats-io/nats.go / getHash

Function getHash

js.go:4117–4125  ·  view source on GitHub ↗

Computes a hash for the given `name`.

(name string)

Source from the content-addressed store, hash-verified

4115
4116// Computes a hash for the given `name`.
4117func getHash(name string) string {
4118 sha := sha256.New()
4119 sha.Write([]byte(name))
4120 b := sha.Sum(nil)
4121 for i := 0; i < nameHashLen; i++ {
4122 b[i] = rdigits[int(b[i]%base)]
4123 }
4124 return string(b[:nameHashLen])
4125}

Callers 2

subscribeMethod · 0.85
resetOrderedConsumerMethod · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected