Click here to Skip to main content
15,887,361 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Below are two different .bmp files that differ only in one pixel, in the left up corner of the first there is a red pixel.
When I compare the two texts the difference is in a quite unexpected place near the end of the strings...
I'm I allowed to ask why?



What I have tried:

It does not allow me to post base64 strings...
Posted
Updated 8-Oct-20 1:36am
v3
Comments
Richard MacCutchan 8-Oct-20 7:24am    
Please use the Improve question link above and add proper details. As it stands it is impossible to guess what you are referring to.

1 solution

We can't see the data but it depends on three things
First, the format of BMP files, which may not be what you expect: BMP file format - Wikipedia[^] - it can contain a whole load more than just the pixel data, and all of that is are the "front" of the file - so the actual pixel bits are at the end, not the start. It's also very possible that changing a pixel will cause additions or subtractions to parts of the header info.
Second, Base64 is not an encoding algorithm - it's a translation algorithm which "spreads" the value of bytes across multiple output characters: so a change in a pixel value can alter several values in the output.
Thirdly, if you start randomly changing values in an actual file (rather than the Image data that most apps work with) you can easily render the file no longer readable as a valid BMP file at all - and it doesn't take big changes to do that! Think of it as your bank card number: if you change one bit in that then one of two things happen: your bank card either accesses the wrong account (very unlikely) or your card s rejected as the number is no longer valid (bank card numbers include error checking to ensure that it's really difficult for small changes to go unnoticed).
 
Share this answer
 
Comments
tool__ 28-Oct-20 13:11pm    
very informative thanks
turns out that the weird thing is that the strings differ in only one character...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900