Skip to content

meowgorithm/node-html-crypt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Node-HTML-Crypt

Self-decrypting JavaScript for general purpose spam defense.

Because the internet really hasn’t changed that much in the last twelve years.™

Ported from the excellent HTML_Crypt package by Mike Dransfield and Christian Weiske which was first released on September 8, 2002.

Installation

npm install html-crypt

Usage

var crypt = require('html-crypt');
crypt('<a href="mailto:karl@example.com>Karl Lagerfeld</a>');

The above outputs a script tag with some gnarly looking JavaScript that that in turn self-decrypts to the given string on page load. Believe it or not, this will still thwart most spam-bots.

Example output

<script type="text/javascript">var a,s,nfunction rkxstbicjzemlnvofdpgawhyqu(s){r=""for(i=0i<s.lengthi++){n=s.charCodeAt(i)if(n<128){n=n-7if(n<32){n=127+(n-32)}}r+=String.fromCharCode(n)}return r}a="Ch'oylmD)thps{vArhysGhtwsl5jvt)ERhys'ShnlymlskC6hE"document.write(rkxstbicjzemlnvofdpgawhyqu(a))</script>

The above will automatically decrypt to <a href="mailto:karl@example.com>Karl Lagerfeld</a>.

With Express 3.x

Adding a Jade helper is easy. Add the following to your Express app…

app.locals.crypt = require('html-crypt');

…and you'll get a helper function in your Jade templates:

p!= crypt('<a href="mailto:karl@example.com">Karl Lagerfeld</a>')

To-Do

Write some tests.

About

Self-decrypting JavaScript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published