Advertisement
Guest User

base64 example

a guest
Jan 12th, 2017
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <Windows.h>
  3.  
  4. #include "base64.h"
  5.  
  6. int main(int argc, char *argv[]) {
  7.     if (argc < 2)
  8.         return 1;
  9.  
  10. DWORD dwCipherTextLen = 0;
  11.     LPBYTE lpCipherText = base64_encode(argv[1], strlen(argv[1]), &dwCipherTextLen);
  12.     for (int i = 0; i < dwCipherTextLen; i++)
  13.         printf("%c", lpCipherText[i]);
  14.     puts("");
  15.  
  16.     DWORD dwPlainTextLen = 0;
  17.     LPBYTE lpPlainText = base64_decode(lpCipherText, dwCipherTextLen, &dwPlainTextLen);
  18.     for (int i = 0; i < dwPlainTextLen; i++)
  19.         printf("%c", lpPlainText[i]);
  20.     puts("");
  21.  
  22.     free(lpCipherText);
  23.     free(lpPlainText);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement