Home
Name Modified Size InfoDownloads / Week
libbase64++_1.1.0.zip 2012-02-24 37.1 kB
README.txt 2012-02-24 4.7 kB
libbase64++_1.0.0.zip 2012-02-23 26.7 kB
Totals: 3 Items   68.5 kB 0
=======================================================================
|	About
=======================================================================
libbase64++ is a C++ head-only library which will do base64 conversions.  It's fully flexible and should fit any and all base64 needs.
Just add libbase64++.h to your project and it will work.

unsigned char * blah = (unsigned char*)"1234567890";  //Something to convert to base64
std::string ssss = libbase64::encode<std::string, char, unsigned char, true>(blah, 11);  //template tells it what to expect and return, 11 bytes long
std::string orig = libbase64::decode<std::string, char, unsigned char, true>(ssss);   //return it to enocoded

Both methods return an empty string on wrong input, unless LIBBASE64_THROW_STD_INVALID_ARGUMENT is defined, in which case it will throw



=======================================================================
|	Functions
=======================================================================

	=======================================================================
	|	encode
	=======================================================================
	STRINGTYPE libbase64::encode<STRINGTYPE, CHARTYPE, UCHARTYPE, SAFETY>(unsigned char * binary, size_t length);
	
	typename STRINGTYPE - the name of the type of string that you want the binary output in (usually std::string)
	typename CHARTYPE - the type of char that goes in the STRINGTYPE (usually char)
	typename UCHARTYPE - the unsigned version of CHARTYPE (usually unsigned char)
	bool SAFETY - a boolean value, whether or not to perform verification on data
	unsigned char * binary - the binary data to be encoded
	size_t length - the number of bytes to encode
	
	This method will take length bytes from binary and convert it into a base64 encoded STRINGTYPE
	
	=======================================================================
	|	decode
	=======================================================================
	std::string libbase64::decode<STRINGTYPE, CHARTYPE, UCHARTYPE, SAFETY>(const STRINGTYPE & str);
	
	typename STRINGTYPE - the name of the type of string that you need decoded
	typename CHARTYPE - the type of char that goes in the STRINGTYPE (usually char)
	typename UCHARTYPE - the unsigned version of CHARTYPE (usually unsigned char)
	bool SAFETY - a boolean value, whether or not to perform verification on string
	const STRINGTYPE & str - the string to be decoded into binary data
	
	This method will take a string and convert it back to binary data, which it stores in an std::string, which can be retrieved from data()



=======================================================================
|	Changelog
=======================================================================
1.1.0 (2/24/12
	Added better unit test suite
	Added code coverage and added tets for missing coverage
	Added bound checking while NDEBUG not defined
	Fixed allocated amounts not perfectly suited for encoding/decoding
	Added fourth template parameter for safety
1.0.0 (2/23/12)
	Initial release, pulled out of libjson 7.5.1



=======================================================================
|	License
=======================================================================
Copyright 2010 Jonathan Wallace. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

	1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

	2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY JONATHAN WALLACE ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JONATHAN WALLACE OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Jonathan Wallace.
Source: README.txt, updated 2012-02-24