MCPcopy Create free account
hub / github.com/encodeous/nylon / CheckMAC1

Method CheckMAC1

polyamide/device/cookie.go:69–84  ·  view source on GitHub ↗
(msg []byte)

Source from the content-addressed store, hash-verified

67}
68
69func (st *CookieChecker) CheckMAC1(msg []byte) bool {
70 st.RLock()
71 defer st.RUnlock()
72
73 size := len(msg)
74 smac2 := size - blake2s.Size128
75 smac1 := smac2 - blake2s.Size128
76
77 var mac1 [blake2s.Size128]byte
78
79 mac, _ := blake2s.New128(st.mac1.key[:])
80 mac.Write(msg[:smac1])
81 mac.Sum(mac1[:0])
82
83 return hmac.Equal(mac1[:], msg[smac1:smac2])
84}
85
86func (st *CookieChecker) CheckMAC2(msg, src []byte) bool {
87 st.RLock()

Callers 2

RoutineHandshakeMethod · 0.80
TestCookieMAC1Function · 0.80

Calls 1

WriteMethod · 0.65

Tested by 1

TestCookieMAC1Function · 0.64