Products
Services
Contact Us

Scripts: Javascript :: Encryption and Obfuscation :: Library Article #36

Developer's Section

Encrypt and Obfuscate Javascript Code using Base 64 Encryption
By: Erobo Software

Hire a Developer for Related Work / Installation | $55 hr
Rating:  | Rate It:   
Average Votes: (75)
Favorites:

Encrypt and Obfuscate Javascript Code using Base 64 Encryption

Sometimes it is a requirement to encrypt / obfuscate Javascript code since competitors and hackers want to obtain a similar function that is typically achieved by client side written code. You can use Fast Wave Encryptor when is necessary to protect the Javascript code you are using for your business application. Below is a demo:



    

A couple of notes:

  • Utilize the Encryption Tool only on Javascript code that hasn't been previously obfuscated / encrypted and that doesn't contain an extremely long list of characters in a single line.
  • Demo is limited to 2000 characters only but you can remove the restriction by purchasing a license.
  • The Fast Wave Encryptor Tool supports the encryption of regular expressions embedded on the code.
  • Tested with up to 1.1 Million characters. Takes 2 mins per each 10000 characters. 59 minutes for 1.1 Million.
Sample Usage:

 Code Snippet 1

<script src="36/scripts/fast_wave_encryptor.js"></script>
  
<script language="Javascript">

function encryptmyfield(input) {
  var fastwave = new Fast_Wave_Encryptor;
  fastwave.imgPath = "36/images/";
  fastwave.workerPath = "36/scripts/";
  //Parameter#1 : The input field you are using to Encrypt the contents.
  //Parameter#2 : Always set to true to allow base 64 encryption to take place.
  //Parameter#3 : Shrink variables (Not recommended for long lines of code). In some cases
  //              shrinking variables can corrupt the code itself or produce Javascript errors.
  //              However, If you need maximum encryption set to 1 but ensure to test the code
  //              accordingly.
  //Parameter#4 : The reference to a span that is going to show you the progress (Red Bars).
  fastwave.pack(input, 1, 0, "ref_update");
}

function decryptmyfield(input) {
  eval("var value=String" + input.value.slice(4));
  input.value = value;
}

</script>
<textarea name="encrypt_input" id="encrypt_input" rows="10" cols="80"></textarea>
<br />
<span id="ref_update" name="ref_update"></span>
<br />
<button id="pack-script" type="button" onclick="encryptmyfield(document.getElementById('encrypt_input'))">
Encrypt / Obfuscate
</button> 
    
<button id="unpack-script" type="button" onclick="decryptmyfield(document.getElementById('encrypt_input'))">
Decode
</button> 


See other Scripts in Encryption and Obfuscation

 

Submit Your Scripts:

If you would like to have your Javascripts published in this section please fill out
the form below:
*Your Name or Username:
Home Town:
*Email:
*Description and Code:
*Enter Code shown
to the right:

[ Refresh Image ]