MCPcopy Create free account
hub / github.com/EasyIME/PIME / compute_accept_value

Method compute_accept_value

python/python3/tornado/websocket.py:887–894  ·  view source on GitHub ↗

Computes the value for the Sec-WebSocket-Accept header, given the value for Sec-WebSocket-Key.

(key: Union[str, bytes])

Source from the content-addressed store, hash-verified

885
886 @staticmethod
887 def compute_accept_value(key: Union[str, bytes]) -> str:
888 """Computes the value for the Sec-WebSocket-Accept header,
889 given the value for Sec-WebSocket-Key.
890 """
891 sha1 = hashlib.sha1()
892 sha1.update(utf8(key))
893 sha1.update(b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11") # Magic value
894 return native_str(base64.b64encode(sha1.digest()))
895
896 def _challenge_response(self, handler: WebSocketHandler) -> str:
897 return WebSocketProtocol13.compute_accept_value(

Callers 2

_challenge_responseMethod · 0.80

Calls 2

utf8Function · 0.90
updateMethod · 0.45

Tested by

no test coverage detected