winzip icon

Base64 encoding/decoding DLL, complete with sample EXE!

Email
Submitted on: 1/2/2015 4:30:00 AM
By: Anonymous (from psc cd)  
Level: Advanced
User Rating: By 14 Users
Compatibility: Microsoft Visual C++
Views: 5431
 
     Base64 is a public encoding/decoding algorithm. It is used in many ways, for example in authorization and E-mail attachments. Let's say you want to enter a site that requests a user name and password (I'm talking about that dialog thing that you get in your browser). You type in "MyUserName" and "MyPassword". At this point the browser first concatenates the strings with a colon between them: "MyUserName:MyPassword". Then it encodes the resulting string with Base64. The result is "TXlVc2VyTmFtZTpNeVBhc3N3b3Jk". This is what is sent to the web-server (this is the process in a non-secure protocol like http - in a secure protocol like https, the process is a bit different). Another use is in E-mail attachments. When you attach a non-text file (such as a JPG file) to your E-mail message, your E-mail client first encodes this file in Base64, and only then sends it to the SMTP server. When you retrieve the E-mail message from the POP server, you receive the encoded file and your E-mail client decodes it to get the original file back. This posting consists of two projects. One is called "Base64" and is a Win32 DLL Project - this DLL contains functions which do the encoding and decoding. It contains documentation, in a file called Base64.exe. The other project is called "YBase64" and is a Win32 EXE Project - this is a sample application which uses the aforementioned DLL. (You can see YBase64 in the attached screen shot) IMPORTANT NOTE: MFC HAS NOT UNLEASHED ITS EVIL POWERS UPON THESE TWO PROJECTS - they are completely and purely Win32. You have two options for encoding and decoding - asynchronous or synchronous. The "spontaneous" encoding/decoding is done synchronously. For the files you have an checkbox which lets you choose (of course, the progress-bar and cancel button aren't operational in synchronous mode). I have done some testing: Encoding a 50.6MB file took about 1 minute and 20 seconds, and decoding the result took about 1 minute and 40 seconds, on my P3 450MHz. I used a file-compare program (FC.EXE which comes with Windows) to compare the result and the original file, byte by byte, and no differences were encountered. If you like this code, please vote and/or submit your feedback! Thanks.

 

INCLUDE files:

Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
//**************************************
//INCLUDE files for :Base64 encoding/decoding DLL, complete with sample EXE!
//**************************************
#include <windows.h>
#include <commctrl.h>
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 21 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments


 There are no comments on this submission.
 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.