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