Hi, I am working on a multiple layer encryption program for my school IT project. Right now the message runs through a Caesar cipher (which the user can select the shift of), it reverses the message and then it reverses the bits of each character, making various symbols come out.

Now I want to add another encryption for it to run through. I want the user to enter a keyword into edtKode, so that the message is encrypted in such a way that it can only be decrypted if the end user also has that keyword. This will happen before the bits are reversed, but after the string itself is reversed. All I want is some examples as to how this can be implemented as well as perhaps some code. I'm still a very basic programmer, but I understand if functions, for loops etc.

Also, any other ideas for ciphers through which the message can go to become even more secure would be apprecated.

Thanks

Unfortunately your encruyption is very weak, as it uses sequence of three operations to map single letters to single letters keeping the letter frequencies of the original message. These could be replaced by doing a single lookup table for each non-ascii letter value 0..255 and for each possible shift for Ceasar -12..13 for the ascii letters.

A stronger simple encryption would be for example simply having a password from user to generate seed number to random number generator by some nice function so slightly different passwords would generate very different seed numbers. Generator could then be used to generate number 0...255 for XOR encrypting the message. That would be quite strong if same password would never be reused.

Edited 5 Years Ago by pyTony: n/a

Thanks for the tips, although I don't really understand most of how this encryption works. Could there be something I could add to my existing encryptions, like one extra layer or whatever it is called, that would make it stronger? The thing is my program needs to use atleast one existing method and one method of my own creation together to create the encryption.

You could shift letter bits out of char boundaries by n bits instead of reversing the bits so the letter frequencies could be mixed up. Only you must also take care what happens with first and last letters of text, and their number of bits shifted could give hint to person cracking your encryption. So you could fill the first and last bytes unused part with random noise bits, which you discard when decrypting.

Can you please give me some code examples as to the implementation of that type of encryption that I can study and adapt to my program? This would be much appreciated

For idea and not to disturb your learning experience I can give you wikipedia link for XOR encryption (it is really simple, but very unsafe if reusing password or if you have one of the files encrypted in unencrypted form):
http://en.wikipedia.org/wiki/XOR_cipher

The out of bytes shift of bits is little complicated, so I can give one pseudocode for your Pascal code:

To shift array n bits:
initialize encrypted message to empty string
get n random bits for fill in as bits_in and shift them left (8-n) bits
for each character in message
    OR the characters ord shifted right n bits with bits_in and add to encrypted message
    take n lowest bits of the ord and shift them left (8-n) bits as new bits_in (make it function)
OR the last bytes bits in with (8-n) random bits and add to encrypted
return encrypted message

Edited 5 Years Ago by pyTony: n/a

How would I go to work shifting the bits left? For reversing the bits, I used not, but I don't know how to shift them in any other way.

OK thanks man, I'll try to figure it out. If I have any difficulty, I'll ask.

This article has been dead for over six months. Start a new discussion instead.