About EncryptJS

EncryptJS is a JavaScript library for encrypting message and embed it as HTML code into your web content. This encrypted message can be decrypted directly from the website with a decryption key. This page provides the generator service for you to get started.

See the examples for more variety of usages and how it works.

1. Set the Decryption Key

NOTE: This key is required to decrypt your encrypted message.

2. Message to Encrypt

P/S: You can use HTML code here.

Optional: To Decrypt a Message

NOTE: For decryption testing purpose, insert the correct key at "1. Set the Decryption Key" section, press "Decrypt" button and your decrypted message will be displayed in "2. Message to Encrypt" section.

3. Generated HTML Code

NOTE: Please refer to Section #5 for how to use this HTML code in your webpage.

4. HTML Code in Preview


6. How to Use It in Your Site

To display the encrypted message in your site:-

  1. Include encrypt.min.js into your site (see the code below).
  2. Encrypt your message here and be sure to remember the decryption key!
  3. Copy the HTML code in the box of Section #4.
  4. Then paste it into your website or blog content.

Importing encrypt.min.js into your site:

<script type="text/javascript" src="//raw.githubusercontent.com/heiswayi/encryptjs/master/encrypt.min.js"></script>

Basically, this is the HTML code structure inside your site for the decryption to work properly:

<div id="uniqueID" title="encrypted text">
    <a href="javascript:decryptText('uniqueID')">Show encrypted text</a>
  • encrypted text is the encrypted text generated from the encryption.
  • uniqueID is a unique name for the element which is automatically generated by the encryption. This can be anything that you want. Just don't put your key here, it's visible to everyone.
  • The decryptText JavaScript function gets the encrypted text from the title of the element with the ID uniqueID. Once decrypted, the contents of the element are replaced with the decrypted text.
  • The two uniqueID's must be exactly the same, otherwise the code won't work.

See the examples for more variety of usages and how it works.