Audiovox P965 Arkusz Danych Strona 222

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 280
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 221
API in C
219
// get md5 of the password + challenge concatenation
md5_init(&state);
md5_append(&state, cNull, 1);
md5_append(&state, (const md5_byte_t *)password, strlen(password));
md5_append(&state, (const md5_byte_t *)szMD5ChallengeBinary, strlen(szMD5ChallengeBinary));
md5_finish(&state, digest);
// convert this digest to a string representation of the hex values
// digest is the binary format of what we want to send
// szMD5PasswordToSend is the "string" hex format
szMD5PasswordToSend = md5DigestToHexString(digest);
clearSentence(&stReadSentence);
DEBUG ? printf("szPasswordToSend = %s\n", szMD5PasswordToSend) : 0;
// put together the login sentence
initializeSentence(&stWriteSentence);
addWordToSentence(&stWriteSentence, "/login");
addWordToSentence(&stWriteSentence, "=name=");
addPartWordToSentence(&stWriteSentence, username);
addWordToSentence(&stWriteSentence, "=response=00");
addPartWordToSentence(&stWriteSentence, szMD5PasswordToSend);
DEBUG ? printSentence(&stWriteSentence) : 0;
writeSentence(fdSock, &stWriteSentence);
stReadSentence = readSentence(fdSock);
DEBUG ? printSentence (&stReadSentence) : 0;
if (stReadSentence.iReturnValue == DONE)
{
clearSentence(&stReadSentence);
return 1;
}
else
{
clearSentence(&stReadSentence);
return 0;
}
}
/********************************************************************
Przeglądanie stron 221
1 2 ... 217 218 219 220 221 222 223 224 225 226 227 ... 279 280

Komentarze do niniejszej Instrukcji

Brak uwag