Base64 strings
-
I have run into a situation where I need to encode/decode base64 in unmanged c++ code, that has been encoded/decoded in .Net 2 tobase64string. However I have not been able to get the unmanaged code to encode/decode the strings generated by tobase64string, and vice-versa. I have tried changing the encoding for the tobase64string input stream, but it did not seem to make a difference. Thinking there was something wrong with the unmanaged code, I found a couple of other base64 implementations on the internet and gave them a try. They have the same problems encoding/decoding the .Net tobase64string output. Before I spend time unraveling the .Net base 64 stuff - does anyone have an algoritm to encode/decode the tobase64string output that they have been able to get working in unmanged code or any tips on what I am doing wrong? Any input is welcomed. TIA
-
I have run into a situation where I need to encode/decode base64 in unmanged c++ code, that has been encoded/decoded in .Net 2 tobase64string. However I have not been able to get the unmanaged code to encode/decode the strings generated by tobase64string, and vice-versa. I have tried changing the encoding for the tobase64string input stream, but it did not seem to make a difference. Thinking there was something wrong with the unmanaged code, I found a couple of other base64 implementations on the internet and gave them a try. They have the same problems encoding/decoding the .Net tobase64string output. Before I spend time unraveling the .Net base 64 stuff - does anyone have an algoritm to encode/decode the tobase64string output that they have been able to get working in unmanged code or any tips on what I am doing wrong? Any input is welcomed. TIA
You might have better luck with that question in the C++ forum. Sorry I can't help.
Try code model generation tools at BoneSoft.com.
-
I have run into a situation where I need to encode/decode base64 in unmanged c++ code, that has been encoded/decoded in .Net 2 tobase64string. However I have not been able to get the unmanaged code to encode/decode the strings generated by tobase64string, and vice-versa. I have tried changing the encoding for the tobase64string input stream, but it did not seem to make a difference. Thinking there was something wrong with the unmanaged code, I found a couple of other base64 implementations on the internet and gave them a try. They have the same problems encoding/decoding the .Net tobase64string output. Before I spend time unraveling the .Net base 64 stuff - does anyone have an algoritm to encode/decode the tobase64string output that they have been able to get working in unmanged code or any tips on what I am doing wrong? Any input is welcomed. TIA
A few simple things to try which will validate that the encoding/decoding code is working properly on each end. Create a Base64 encoded string in .NET and then pass it to your decode function. You should get back the same result. Do this same test in the C++ code. This will verify that you can properly encode/decode a string in each of the respective languages. Once you verify that you can encode/decode properly, try to encode the same string in .NET and C++ and compare the results, which will be the Base64 encoded string. If the values are not the same, then you know one of the implementations isn't working correctly. Finally, assuming that everything else looks correct, you will need to step through with a debugger (or use Console.Writeline and printf statements) to ensure that the result of the encode is accurately being passed to the decode function (or vice versa). Also, on the C++ side, make sure you are clearing your strings (or char[] if that's what you are using) and make sure that it is being null terminated properly.
Scott.
—In just two days, tomorrow will be yesterday. [Forum Guidelines] [Articles] [Blog]