Linksys WVC80N User Guide - Page 43

Wireless-N Internet Home Monitoring Camera, decrypted string length

Page 43 highlights

Appendix D else if(chr3 == (char)0) { enc4 = 64; } o_buf[j++] = keyStr[enc1]; o_buf[j++] = keyStr[enc2]; o_buf[j++] = keyStr[enc3]; o_buf[j++] = keyStr[enc4]; // OK, now clean out the variables used. chr1 = chr2 = chr3 = (char)0; enc1 = enc2 = enc3 = enc4 = (char)0; } while (i < strlen(i_buf )); //And finish off the loop //Now return the encoded values. return j; } // Description: decrypt the input data with the base64 // Input: // char i_buf[] - input buffer // Output: // char o_buf[] - output buffer // Return: // decrypted string length int decode64(char i_buf[], char o_buf[]) { //These are the 3 bytes to be encoded char chr1 = (char)0; char chr2 = (char)0; char chr3 = (char)0; //These are the 4 encoded bytes int enc1 = 0; int enc2 = 0; int enc3 = 0; int enc4 = 0; int i = 0, j = 0; //Position counter do { //Here's the decode loop. //Grab 4 bytes of encoded content. enc1 = (int)(strchr(keyStr, i_buf[i++]) - keyStr); if(i < strlen(i_buf )) enc2 = (int)(strchr(keyStr, i_buf[i++]) - keyStr); if(i < strlen(i_buf )) enc3 = (int)(strchr(keyStr, i_buf[i++]) - keyStr); if(i < strlen(i_buf )) enc4 = (int)(strchr(keyStr, i_buf[i++]) - keyStr); Wireless-N Internet Home Monitoring Camera CGI Commands 42

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66

Appendix D
CGI Commands
42
Wireless-N Internet Home Monitoring Camera
else if(chr3 == (char)0) {
enc4 = 64;
}
o_buf[j++] = keyStr[enc1];
o_buf[j++] = keyStr[enc2];
o_buf[j++] = keyStr[enc3];
o_buf[j++] = keyStr[enc4];
// OK, now clean out the variables used.
chr1 = chr2 = chr3 = (char)0;
enc1 = enc2 = enc3 = enc4 = (char)0;
} while (i < strlen(i_buf)); //And finish off the loop
//Now return the encoded values.
return j;
}
//--------------------------------------------------------------------
//
Description:
decrypt the input data with the base64
//
Input:
//
char i_buf[]
- input buffer
//
Output:
//
char o_buf[]
- output buffer
//
Return:
//
decrypted string length
//--------------------------------------------------------------------
int decode64(char i_buf[], char o_buf[]) {
//These are the 3 bytes to be encoded
char chr1 = (char)0;
char chr2 = (char)0;
char chr3 = (char)0;
//These are the 4 encoded bytes
int enc1 = 0;
int enc2 = 0;
int enc3 = 0;
int enc4 = 0;
int i = 0, j = 0; //Position counter
do { //Here’s the decode loop.
//Grab 4 bytes of encoded content.
enc1 = (int)(strchr(keyStr, i_buf[i++]) - keyStr);
if(i < strlen(i_buf))
enc2 = (int)(strchr(keyStr, i_buf[i++]) - keyStr);
if(i < strlen(i_buf))
enc3 = (int)(strchr(keyStr, i_buf[i++]) - keyStr);
if(i < strlen(i_buf))
enc4 = (int)(strchr(keyStr, i_buf[i++]) - keyStr);