int IsLowercase(signed int character)
{
int result;
result = character >= 'a' && character < '{';
return result;
}
int UpperCaseToLower(int Character)
{
if ( IsLowercase(Character) )
Character -= 32;
return Character;
}
void StrToHex(_BYTE *HexStr, char *HexNum)
{
_BYTE *tHexStr;
char *tHexNum;
signed int Count;
int HexResult;
char LowCaseCharacter;
char tCount;
tHexStr = HexStr;
tHexNum = HexNum;
Count = 0;
HexResult = 0;
while ( Count < strlen(HexStr)-1 && *tHexStr )
{
LowCaseCharacter = UpperCaseToLower((char)*tHexStr++);
if ( LowCaseCharacter < 0x30 || LowCaseCharacter >= 0x3A )
{
if ( LowCaseCharacter < 'A' || LowCaseCharacter >= 'G' )
{
printf((int)"key must be in hexadecimal notation\n");
return;
}
HexResult = LowCaseCharacter + 16 * HexResult - 0x37;
}
else
{
HexResult = LowCaseCharacter + 16 * HexResult - 0x30;
}
tCount = Count++;
if ( tCount & 1 )
tHexNum[Count / 2 - 1] = HexResult;
}
}