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

Function V_hextobinary

tests/test_crypto.cpp:50–70  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

48
49//-----------------------------------------------------------------------------
50static void V_hextobinary( char const *in, int numchars, byte *out, int maxoutputbytes )
51{
52 int len = V_strlen( in );
53 numchars = min( len, numchars );
54
55 // Make sure it's even
56 numchars = ( numchars ) & ~0x1;
57
58 memset( out, 0x00, maxoutputbytes );
59
60 byte *p;
61 int i;
62
63 p = out;
64 for ( i = 0;
65 ( i < numchars ) && ( ( p - out ) < maxoutputbytes );
66 i+=2, p++ )
67 {
68 *p = ( Q_nibble( in[i] ) << 4 ) | Q_nibble( in[i+1] );
69 }
70}
71
72//-----------------------------------------------------------------------------
73// Purpose: Tests cryptography hex encoding

Callers 1

TestEllipticCryptoFunction · 0.85

Calls 2

V_strlenFunction · 0.85
Q_nibbleFunction · 0.85

Tested by

no test coverage detected