The TXT file contains 4e6574776fda-b205365637572697479.
However, after running, it is not the hexadecimal content in the TXT file,
# Include <iostream. h>
# Include <stdio. h>
# Include <string. h>
# Include <stdlib. h>
Typedef unsigned char byte;
Typedef unsigned int DWORD;/* 32 bit data type */
Byte hex_value (byte value)
{
Return (Value & 0x7f)> = 'A ')? (Value-7): Value) & 0x0f;
}
Void compress (byte * DEST, byte * Source, DWORD pair)
{
While (pair)
{
Pair --;
* DEST = (hex_value (* Source ++) <4 );
* DEST ++ = hex_value (* Source ++ );
}
}
Int main ()
{
File * FP;
Unsigned char buffer [50];
Unsigned char buf2 [25];
If (FP = fopen ("f1.txt", "AB +") = NULL)
{
Cout <"cannot open the des_plain.txt" <Endl;
Exit (0 );
}
Fread (buffer, 32, 1, FP );
Compress (buf2, buffer, 16 );
For (INT I = 0; I <16; I ++)
{
Printf ("% 02x", buf2 [I]);
}
Fclose (FP );
Return 0;
}
Read_txt.cpp E: \ vctest