Skip to content

Instantly share code, notes, and snippets.

@bdesham
Created August 11, 2012 20:26
Show Gist options
  • Save bdesham/3327022 to your computer and use it in GitHub Desktop.
Save bdesham/3327022 to your computer and use it in GitHub Desktop.
Obfuscate text for use in web pages
; Replaces each character with an HTML escape code like " ".
; This is useful as some lightweight protection against e-mail harvesting;
; it probably won't perform correctly with non-ASCII input.
;
; example:
; (obfuscate "example.com")
; => "example.com"
(defn obfuscate
[text]
(apply str (map #(format "&#x%x;" (int %))
text)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment