Audiovox P965 Arkusz Danych Strona 133

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 280
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 132
API In CPP
130
}
return strReturn;
}
/********************************************************************
* MD5 helper function to calculate and return hex representation
* of an MD5 digest stored in binary.
********************************************************************/
string MikrotikAPI::MD5DigestToHexString(md5_byte_t *binaryDigest)
{
char strReturn[32 + 1];
for (int i = 0; i < 16; ++i) {
sprintf(strReturn + i * 2, "%02x", binaryDigest[i]);
}
return strReturn;
}
/********************************************************************
* Quick and dirty function to convert hex string to char...
* the toConvert string MUST BE 2 characters + null terminated.
********************************************************************/
char MikrotikAPI::HexStringToChar(const string &hexToConvert)
{
unsigned int accumulated = 0;
char char0[2] = {hexToConvert[0], 0};
char char1[2] = {hexToConvert[1], 0};
// look @ first char in the 16^1 place
if (hexToConvert[0] == 'f' || hexToConvert[0] == 'F') {
accumulated += 16*15;
} else if (hexToConvert[0] == 'e' || hexToConvert[0] == 'E') {
accumulated += 16*14;
} else if (hexToConvert[0] == 'd' || hexToConvert[0] == 'D') {
accumulated += 16*13;
} else if (hexToConvert[0] == 'c' || hexToConvert[0] == 'C') {
accumulated += 16*12;
} else if (hexToConvert[0] == 'b' || hexToConvert[0] == 'B') {
accumulated += 16*11;
} else if (hexToConvert[0] == 'a' || hexToConvert[0] == 'A') {
accumulated += 16*10;
} else {
accumulated += 16 * atoi(char0);
}
Przeglądanie stron 132
1 2 ... 128 129 130 131 132 133 134 135 136 137 138 ... 279 280

Komentarze do niniejszej Instrukcji

Brak uwag