MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / computeAccept

Method computeAccept

Libraries/Http/HttpWebSocket.cpp:396–408  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

394 }
395 const auto openAlgorithm = reinterpret_cast<HttpWebSocketBCryptOpenAlgorithmProvider>(
396 GetProcAddress(library, "BCryptOpenAlgorithmProvider"));
397 const auto hash = reinterpret_cast<HttpWebSocketBCryptHash>(GetProcAddress(library, "BCryptHash"));
398 const auto closeAlgorithm = reinterpret_cast<HttpWebSocketBCryptCloseAlgorithmProvider>(
399 GetProcAddress(library, "BCryptCloseAlgorithmProvider"));
400
401 bool success = false;
402 if (openAlgorithm != nullptr and hash != nullptr and closeAlgorithm != nullptr)
403 {
404 BCRYPT_ALG_HANDLE algorithm = nullptr;
405 if (openAlgorithm(&algorithm, BCRYPT_SHA1_ALGORITHM, nullptr, 0) >= 0)
406 {
407 success = hash(algorithm, nullptr, 0, const_cast<PUCHAR>(data.data()), dataSize, digest, 20) >= 0;
408 (void)closeAlgorithm(algorithm, 0);
409 }
410 }
411 FreeLibrary(library);

Callers

nothing calls this directly

Calls 5

reinterpret_bytesFunction · 0.85
addMethod · 0.45
sizeInBytesMethod · 0.45
finishMethod · 0.45

Tested by

no test coverage detected