MCPcopy Create free account
hub / github.com/axmolengine/axmol / generateHandshakeSecKey

Method generateHandshakeSecKey

core/network/WebSocket.cpp:507–518  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

505}
506
507void WebSocket::generateHandshakeSecKey()
508{
509 char rand_key[16] = {0};
510 int* p = reinterpret_cast<int*>(rand_key);
511 for (int i = 0; i < 4; ++i, ++p)
512 *p = ax::random();
513 _handshakeSecKey = utils::base64Encode(std::span{rand_key});
514
515 auto signContent = _handshakeSecKey;
516 signContent += "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"sv;
517 _verifySecKey = utils::computeDigest(signContent, "sha1"sv, utils::DigestPresent::Base64);
518}
519
520void WebSocket::handleNetworkEvent(yasio::io_event* event)
521{

Callers

nothing calls this directly

Calls 3

randomFunction · 0.85
computeDigestFunction · 0.85
base64EncodeFunction · 0.50

Tested by

no test coverage detected