![]() ![]() ![]() Permission is granted to anyone to use this software for any purpose, In no event will the author be held liable for any damages This source code is provided 'as-is', without any express or implied ![]() Putting the code below in case the site goes down: None of answers satisfied my needs, I needed simple two-function solution for encoding and decoding, but I was too lazy to write my own code, so I found this: I needed C implementation working on std::string. Printf("Base-64 decoded string is: %s\n", base64_decoded) //Prints base64 decoded string.įree(base64_encoded) //Frees up the memory holding our base64 encoded data.įree(base64_decoded) //Frees up the memory holding our base64 decoded data. Printf("Base-64 encoded string is: %s\n", base64_encoded) //Prints base64 encoded string. Printf("Original character string is: %s\n", data_to_encode) //Prints our initial string. Int bytes_to_decode = strlen(base64_encoded) //Number of bytes in string to base64 decode.Ĭhar *base64_decoded = base64decode(base64_encoded, bytes_to_decode) //Base-64 decoding. Int bytes_to_encode = strlen(data_to_encode) //Number of bytes in string to base64 encode.Ĭhar *base64_encoded = base64encode(data_to_encode, bytes_to_encode) //Base-64 encoding. *Here's one way to base64 encode/decode using the base64encode() and base64decode functions.*/Ĭhar data_to_encode = "Base64 encode this string!" //The string we will base-64 encode. Return base64_decoded //Returns base-64 decoded data with trailing null terminator. Static char encoding_table = //Once we're done reading decoded data, BIO_read returns -1 even though there's no error.īIO_free_all(b64_bio) //Destroys all BIOs in chain, starting with b64 (i.e. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |