-----------------------------------------------------------------------------
| 48 | |
| 49 | //----------------------------------------------------------------------------- |
| 50 | static 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 |
no test coverage detected