A
A
a11aud2012-09-02 09:21:49
Python
a11aud, 2012-09-02 09:21:49

Why is there an error when decoding base64 from c++ to python?

There is a program written in QT (c++). The program reads the file, encodes it to base64 and sends this string to the server. The server decrypts and writes back to the file. For some reason, part of the file is distorted (it's an image). If the image is sent to the server through a client script in python, then there is no distortion.

The comrade said that most likely there are distortions in the implementation of the base64 encoding algorithm (different RFCs, old in qt). Who can say anything about this? How can you get around? Maybe some modern implementation is?

PS Yes, I know that it is possible to send a file without encoding it. But there are some features here, because of which you still have to encode.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey, 2012-09-02
@Ualde

Well, somehow fortune-telling comes out. If in one case there are no distortions during loading, then most likely - there is an incorrect loading in the first case.
Tried to decode using any online decoders? For example, base64.ru/

M
mejedi, 2012-09-02
@mejedi

Well, look what the program sends.
Have a look at this just in case en.wikipedia.org/wiki/Base64#Variants_summary_table

B
barker, 2012-09-03
@barker

Very strange. If there were “different base64s”, that is, jambs at the transmission level, then the resulting file would be so messed up that it simply would not open. If “there are distortions”, then I am also for the fact that the source server is already trying to send a distorted picture.

A
AxisPod, 2012-09-03
@AxisPod

But are the = characters lost at the end of the encoded string? Yes, give examples.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question