September 25, 2002

Kama-Sutra Algorithm

Can't sleep, and decided to go online to chat with some old friends a couple of hours ago(Started at about 1:30am). Got in a heated debate with Jason about my belief in how cryptography has been around in so many forms, allowing us to win WWII (argue with me all you want dude.. but without the breaking of Enigma.... many a battle would have turned out different. Geeks did more to help win the war than you think. Yet we get very little credit for it.) to the Kama-sutra... useful crypto dates back way before most people think.

Anyways, in the middle of all this the gauntlet was thrown down that I can't actually write USEFUL crypto code with just a browser (and no compiler or crypto libs) to deal with what happened way back then. I rarely take on challenges, as I don't need or care to prove myself... but I thought this would be fun enough to make an exception. SO .. to prove you wrong Dr. J..... here is my Kama-sutra algorithm in Javascript *ppfttt*

Ok, some background for some of you that have no clue what I am talking about. One of the oldest forms of substitution encryption is dated back to something like the 4th or 5th century in the original writings of the Kama-sutra. Yes the sex box thing. But the Kama-sutra is more than just about the exileration of a hightened awareness of sexual feeling. It stressed highly a recommendation for women to study 64 arts, which ranged from cooking to chess. The 45th art was the art of secret writings, which was supposed to be a way for women to secretly be able to communicate and conceal the details of "relationships" they may have. Now adays I think they call those "Harloquin Romance novels" or something like that. Ok, maybe not.

Anyways, the Kama-sutra algorithm is a simple pairing algorithm. In other words, you divide the 26 letters in the alphabet into 13 pairs, matching each other up. A simple example could be something like:

A C E G I K M O Q S U W Y
B D F H J L N P R T V X Z

Now, if I wanted to apply the algorithm on a text message such as:

Meet me behind the oak tree.

I would replace the M with the N, the e with the F etc etc. After encrypting it,
the cipher text would look like:

NFFS NF AFGJMC SGF PBL SQFF.


Sidebar: In case you are new to crypto... you will normally find cipher text
in upper case, and plain text in lower case.

Sidebar2: Did you notice that using that pairing... foo=epp. How quaint.

When I was in junior high, this is how we used to pass notes to each other. Used to piss off the teacher when they confiscated it and wanted to read it to the class. I remember getting in HUGE trouble with the math teacher once, and was forced to explain to the principal what the note said, and how we wrote it. They had a hard time explaining to my grandmother that while in class we were playing with encryption ciphers which was beyond them *laugh*. I had a harder time explaining why I knew what the Kama-sutra was.

Anyways.... here is my Kama-sutra algorithm. Dr. J.... I would like the case of Mountain Dew brought up the next time you are in Canada :)

 

Plain Text:
Cipher Text:

Anyways, thats about it. I guess I could make it more intelligent and clean... but I am just trying to show that it is possible with a "mere browser". It is useful enough to actually create Kama-sutra style message either randomly.. or with a pre-shared set of pairs. And of course... the whole reason I started all this was to show it COULD be done in a browser without crypto libs or a compiler, and to get tired so I could go to sleep. Mission accomplished. *yawn*

:)

Its now almost 4am. I gotta get some sleep before the product demo tomorrow ^H^H^H^H today at 10am.

I'm outta here.

Posted by SilverStr at September 25, 2002 03:49 AM