While studying a source of an app, I came accross a different kind of base64 encoding. I tried decoding it with multiple charsets and it always produced a output like following with
Half of the string decoded exactly. After decoding multiple strings the fisrt half is as expected, but the other half is like above.
Looking at the source code, the app used Couchbase lite. The code reponsible for encoding is here. I touched java just weeks before and new to android apps. I would like to understand how the string is different from normal base64. I had googled a lot to understand the code in above link, but counldn't.
Another Example string:
I have encrypted some text in C# like below:
var encriptedCredential = Convert.ToBase64String(Encoding.Unicode.GetBytes(JsonConvert.SerializeObject("Sample text")));
The encrypted String is :
I want to decrypt the encrypted String in java script.
I have tried the below
The result is something different, There are some spaces in each letter. I cant even replace the spaces.
I have a string containing mathematical symbols which I want to encode and decode in java.
I want to know whether encoding and decoding by 'Base64' will suffice for the same.
Can you please help me to know that 'Base64' supports mathematical symbols? like,
I've heard people talking about "base 64 encoding" here and there. What is it used for?
I encode data of images in base64 using python before sending it to the server which is written in C#. The data that is received is identical to the data that is being sent. However, when I decode the encoded string I get a different result. Here is the code that takes a screenshot and encodes it in base64:
screen_shot_string_io = StringIO.StringIO()ImageGrab.grab().save(screen_shot_string_io, "PNG")screen_shot_string_io.seek(0)return base64.b64encode(screen_shot_string_io.getvalue())
it is sent as is to the server and the server receives the encoded string correcetly with no data corruption.
Here is the c# code that decodes the string:
byte decodedImg = new byte[bytesReceived];FromBase64Transform transfer = new FromBase64Transform();transfer.TransformBlock(encodedImg, 0, bytesReceived, decodedImg, 0);
So does anyone know why when the data is decoded the result is incorrect?