MCPcopy Create free account
hub / github.com/ValveSoftware/GameNetworkingSockets / GetBinaryBlob

Method GetBinaryBlob

tests/test_crypto.cpp:200–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198 }
199
200 bool GetBinaryBlob( const char *pszTag, std::string &blob )
201 {
202 char line[2048];
203 RETURNFALSEIFNOT( fgets( line, sizeof(line), f ) );
204 int lTag = V_strlen(pszTag);
205 RETURNFALSEIFNOT( V_strnicmp( line, pszTag, lTag ) == 0 );
206 const char *p = line + lTag;
207 while ( isspace(*p) )
208 ++p;
209 CHECK_EQUAL( *p, '=' );
210 ++p;
211 while ( isspace(*p) )
212 ++p;
213
214 uint8 decodedData[ 1024 ];
215 uint32 cbDecodedData = sizeof(decodedData);
216 RETURNFALSEIFNOT( CCrypto::HexDecode( p, decodedData, &cbDecodedData ) );
217 blob.assign( (char *)decodedData, cbDecodedData );
218 return true;
219 }
220};
221
222void TestSymmetricAuthCrypto_EncryptTestVectorFile( const char *pszFilename )

Calls 3

V_strlenFunction · 0.85
V_strnicmpFunction · 0.85
assignMethod · 0.80

Tested by

no test coverage detected