Skip to content

Instantly share code, notes, and snippets.

@aggrolite
Last active August 15, 2022 13:27
Show Gist options
  • Save aggrolite/5138710 to your computer and use it in GitHub Desktop.
Save aggrolite/5138710 to your computer and use it in GitHub Desktop.
email deobfucsator
function obfuscateText(coded, key) {
// Email obfuscator script 2.1 by Tim Williams, University of Arizona
// Random encryption key feature by Andrew Moulden, Site Engineering Ltd
// This code is freeware provided these four comment lines remain intact
// A wizard to generate this code is at http://www.jottings.com/obfuscator/
shift = coded.length
link = ""
for (i = 0; i < coded.length; i++) {
if (key.indexOf(coded.charAt(i)) == -1) {
ltr = coded.charAt(i)
link += (ltr)
}
else {
ltr = (key.indexOf(coded.charAt(i)) - shift + key.length) % key.length
link += (key.charAt(ltr))
}
}
document.write("<a href='mailto:" + link + "'>" + link + "</a>")
}
# http://www.jottings.com/obfuscator/
method _get_email($coded, $key) {
my $email;
my @chars = split(//, $coded);
my @keys = split(//, $key);
for (my $i = 0; $i < @chars; $i++) {
if ($keys[-1] eq $chars[$i]) {
$email .= $chars[$i];
}
else {
my ($index) = firstidx { $_ eq $chars[$i] } @keys;
my $pos = ($index - @chars + @keys) % @keys;
$email .= $keys[$pos];
}
}
return $email;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment