MCPcopy Create free account
hub / github.com/ddnet/ddnet / CalculateSha256

Function CalculateSha256

src/engine/shared/http.cpp:81–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81static bool CalculateSha256(const char *pAbsoluteFilename, SHA256_DIGEST *pSha256)
82{
83 IOHANDLE File = io_open(pAbsoluteFilename, IOFLAG_READ);
84 if(!File)
85 {
86 return false;
87 }
88 SHA256_CTX Sha256Ctxt;
89 sha256_init(&Sha256Ctxt);
90 unsigned char aBuffer[64 * 1024];
91 while(true)
92 {
93 unsigned Bytes = io_read(File, aBuffer, sizeof(aBuffer));
94 if(Bytes == 0)
95 break;
96 sha256_update(&Sha256Ctxt, aBuffer, Bytes);
97 }
98 io_close(File);
99 *pSha256 = sha256_finish(&Sha256Ctxt);
100 return true;
101}
102
103bool CHttpRequest::ShouldSkipRequest()
104{

Callers 1

ShouldSkipRequestMethod · 0.85

Calls 6

io_openFunction · 0.85
io_readFunction · 0.85
io_closeFunction · 0.85
sha256_initFunction · 0.50
sha256_updateFunction · 0.50
sha256_finishFunction · 0.50

Tested by

no test coverage detected