I am writing a program in python (myself) to encrypt images. I don't want or expect it to be state of the art encryption and safe at the end but i have a problem. The result encrypted image still has a recognizable trace of the original image. I know its because of they way i am encrypting it.... so what my program does it loads an image as an array of integer values for all pixel colors (RGB) and then i convert an ASCII password into numbers from 0-94 (type-able characters) and then use a saved randomly generated dictionary to map these numbers randomly to numbers from 0-255 so that i would avoid colors possibly staying to similar. Then i use this number to shift the pixel values with formula old_pixel_value + hashed_password_character mod 256. The problem is though that if there is a big white-space or a patch of uniform color there are these repeating stripes and then you can kind of still recognize the shape ill put a picture below. So how do i change or what do i add so that the encrypted image seems more random???
What you've done is this:-
It's called electronic code book style encryption. For block cipher encryption read your own pixel transformation algorithm. And for plain text, read original pixel values. Can you see the how the pattern repeats? That's the length of your hashed password, and what's called the block width. You've used it over and over again encrypting a block width's amount of pixels. Because the background is constant white, it encrypts to the same value over and over. And as the block width straddles the bike, it kinda still shows up against the constantly repeated background.
What you need to do it this:-
It's called cipher block chaining and creates a relationship between sequential blocks. You'll have to adjust your algorithm so that one block's data is somehow propagated to the next one. The traditional way (as illustrated) is to simply xor it. Now every subsequent block will be affected by the previous block and you'll get a much more random pattern.
You don't need the initialisation vector thing at the moment. You can address that later when your chaining algorithm works. It's highly recommended though to stop relay attacks and leak encrypted information when you repeatedly transmit the same information (the cipher text will be identical each time suggesting the same information was sent).
Note. It's also traditional to use a fairly complicated set of xor and bit shift operations to encrypt your information /image. These would be inside the block cipher encryption box. They create an avalanche effect so very small changes create massive ones. You use just a shift operator. I'm not 100% confident that a simple shift will not still show the bike's outline somewhat. Anyone?