|
Unreviewed Code - Shingle Encryption Documentation
This is a simple but effective encryption algorithm that has shown to be very quick to execute in
spite of the Progress 4gl's known weakness in processing text. The algorithm is called "Shingle"
because it encrypts text by overlaying it repeatedly with an encoded version of a decryption key. This overlay
process uses simple addition to add the ASCII values of the characters together. If the value of a
given character is over 255, then 255 is subtracted. Finally, a checksum is added and the string
is converted to base 36 so that it can be easily used in URLs and embedded in text without escaping
out special characters.
How to use:
- Place encrypt.i in your working directory into a directory called "lib".
- Place base36.i in your working directory into a directory called "lib".
- Try the following code in your scripting lab
{lib/encrypt.i}
define var mystring as char no-undo.
assign mystring = "The quick brown fox jumped over the lazy dogs".
{&out} mystring "<br>" skip.
assign mystring = encrypt(mystring,"mysecret").
{&out} mystring "<br>" skip.
assign mystring = decrypt(mystring,"mysecret").
{&out} mystring "<br>" skip.
To be done:
- Currently since the encrypted product is converted to base 36, there is a 2:1 expansion of the
encrypted text. I would like to use base64 instead, so that we can have a 3:2 expansion.
Problems with this are that because Progress 4gl is case-insensitive by default, base64 may be
incorrectly interpreted or matched without jumping through some hoops. Also not sure how to deal
with an odd number of bytes.
- Check out other compression algorithms.
- Add more hashing so that byte positions get switched around based on the key.
[Download encrypt.i]
[Download base36.i]
[Return to Unreviewed Code Section]
[Return to Main Download Page]
|