MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / computeSessionHash

Function computeSessionHash

sdk/cliproxy/auth/selector.go:752–764  ·  view source on GitHub ↗
(systemPrompt, userMsg, assistantMsg string)

Source from the content-addressed store, hash-verified

750}
751
752func computeSessionHash(systemPrompt, userMsg, assistantMsg string) string {
753 h := fnv.New64a()
754 if systemPrompt != "" {
755 h.Write([]byte("sys:" + systemPrompt + "\n"))
756 }
757 if userMsg != "" {
758 h.Write([]byte("usr:" + userMsg + "\n"))
759 }
760 if assistantMsg != "" {
761 h.Write([]byte("ast:" + assistantMsg + "\n"))
762 }
763 return fmt.Sprintf("msg:%016x", h.Sum64())
764}
765
766func truncateString(s string, maxLen int) string {
767 if len(s) > maxLen {

Callers 1

extractMessageHashIDsFunction · 0.85

Calls 1

WriteMethod · 0.45

Tested by

no test coverage detected