RSA Security Projection Television 5.2.2 Instrukcja Użytkownika Strona 195

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 376
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 194
Chapter 5 Non-Cryptographic Operations 173
Converting Data Between Binary and ASCII
Step 4: Update
Enter the data to encode through B_EncodeUpdate. The application is responsible for
allocating the space for the output of this routine. When encoding, for each three bytes
of input there are four bytes of output. So when allocating space, multiply the input
size by 4/3 and round up. If memory is not an issue, you can make the output buffer
twice the size of the input length.
Given pre-existing binary input, your calls to the Update functions would be as
follows:
if ((status = B_EncodeInit (asciiEncoder)) != 0)
break;
/* We are assuming binaryData already points to allocated
space and contains the data to encode into ASCII.
*/
unsigned char *binaryData;
unsigned int binaryDataLen;
unsigned char *asciiEncoding = NULL_PTR;
unsigned int asciiEncodingLenUpdate;
/* Allocate a buffer twice the size of the binary data */
asciiEncoding = T_malloc (binaryDataLen * 2);
if ((status = (asciiEncoding == NULL_PTR)) != 0)
break;
if ((status = B_EncodeUpdate
(asciiEncoder, asciiEncoding, &asciiEncodingLenUpdate,
(binaryDataLen * 2), binaryData, binaryDataLen)) != 0)
break;
Przeglądanie stron 194
1 2 ... 190 191 192 193 194 195 196 197 198 199 200 ... 375 376

Komentarze do niniejszej Instrukcji

Brak uwag