954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Encryption program

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

Fireprufe15
Light Poster
41 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

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.

pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

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.

Fireprufe15
Light Poster
41 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

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.

pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

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

Fireprufe15
Light Poster
41 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

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
pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

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.

Fireprufe15
Light Poster
41 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 
pyTony
pyMod
Moderator
5,359 posts since Apr 2010
Reputation Points: 782
Solved Threads: 852
 

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

Fireprufe15
Light Poster
41 posts since Sep 2011
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: