Encryption

Alexander Kriegisch Alexander at Kriegisch.name
Mon Mar 3 23:09:51 UTC 2008


Well, this is extremely simple and not very refined,
but try something like this:


# Alphabets for en-/decoding (must contain same characters, only in different order)
decoded_chars='A-Za-z0-9\n _;.:#+*/"!'
encoded_chars='mn0opj\nYZk _;.rGJX6IHu12tsWVU5ql3a:e#+zFTEDRS4CBAyxwvd*b/f"9gQPONch8!iMKL7'

# Encode file
cat myfile.gz | tr "$decoded_chars" "$encoded_chars" > myfile.gz.enc
# Decode file
cat myfile.gz.enc | tr "$encoded_chars" "$decoded_chars" > myfile.gz.dec

# Make sure decoded file equals original
md5sum myfile.gz*
e7720032bb3f6579d7e9cc2edcf1f9df  myfile.gz
e7720032bb3f6579d7e9cc2edcf1f9df  myfile.gz.dec
4b630933f0ebf0af2e159bf41272a30f  myfile.gz.enc


Just a quick hack.

Now you can start improving this little sample by adding more
characters (even control characters or full 256-character alphabets),
adding a shell function automatically creating keys from given
alphabets etc.

--
Alexander Kriegisch
Certified ScrumMaster
http://scrum-master.de



Kevin Holland:
> That sounds good,
> I'd like to see that as long as you think it will work on gziped
> archives.
> Thanks
> 
> Kevin
> 
> On Mon, 2008-03-03 at 18:30 +0100, Alexander Kriegisch wrote:
>> Well, Kevin,
>>
>> now that you have answered yourself, we can stop speculating ans start
>> offering suggestions. :-) If this is not too simple for your purpose,
>> you can quite cheaply en-/decrypt files using 'tr' by scrambling
>> arbitrary characters with a fixed key. This way you can either achieve a
>> Caesar cipher or something more complicated, but definitely not strong
>> encryption. Anyway, it would work. In case you are interested, I might
>> hack a little sample for you. It should be enough to keep the lamers out.




More information about the busybox mailing list