Javacrypt – A JavaScript Implementation of crypt(3)

Tags: — Jeff @ 04:41

A while back I was searching for a JavaScript-based implementation of crypt(3). While the function’s no longer particularly secure, it still has plenty of uses. There are plenty of CGI-based scripts to run the function for you, but of course that’s rather insecure – you’re telling the owner of the site the password you intend to use. While the effective risks of doing this are rather small (after all, you’re just an IP address to the host), I didn’t feel totally comfortable doing this. Consequently, I decided to rewrite the algorithm in JavaScript.

I actually started doing this two separate times, but I quit the first time because I wasn’t making any progress. It’s not that the function’s supremely difficult to implement (it isn’t). The real problem was that I couldn’t find source code for it anywhere. There’s also a crypt function used to emulate an Enigma machine that stymied my search efforts for a while. Finally, however, I found it: a Java-based implementation. This would turn out quite well, actually – my programming knowledge at the time was close to nil, and Java’s distinct syntactical similarities to JavaScript prove extremely helpful as I mangled my way through porting code I couldn’t read into another language.

Anyway, here’s the script I wrote. It’s incredibly horrible syntax-wise, but at the time I’d had no formal programming experience whatsoever. I intend to clean it up when time permits, which may be a while.


More later when I have time…


  1. Hallo.

    Is there anyway to run javacrypt without the request “SALT” and without the salt-output box ?? if yes, how can i relize it. Can give me an example or maybe you can change the script ??

    Best regards


    [Right now, I doubt it without changes; this code is fairly ugly and in need of severe refactoring.  Maybe I’ll have time to get to that sometime soon, but it’s unlikely.]

    Comment by Mike — 23.08.06 @ 06:57

  2. […] crypt(3): http://whereswalden.com/tech/internet/javacrypt/ […]

    Pingback by よくあるエンコード/デコード関係のウェブツールを使いやすくした- jamadam weblog2 — 29.09.10 @ 08:27

  3. […] crypt(3): http://whereswalden.com/tech/internet/javacrypt/ […]

    Pingback by More Handy Encode / Decode Web App- jamadam weblog2 — 29.09.10 @ 10:09

RSS feed for comments on this post. TrackBack URI

Leave a comment

HTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>