Generate MD5 Hash From String With jQuery - md5.js

File Size: 8.39 KB
Views Total: 21080
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Generate MD5 Hash From String With jQuery - md5.js

md5.js is a lightweight, jQuery-based, client-side MD5 generator that generates an MD5 hash from any string you specify.

Used for encrypting the password, credit card, and other private data when stored in the database.

How to use it:

1. Import the minified version of the jQuery md5.js library after jQuery.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="jquery.md5.min.js"></script>

2. Convert a string into a MD5 hash.

$.MD5(string);

3. The HTM & JavaScript to create a basic MD5 hash generator app.

<label for="input">Input: </label>
<textarea name="input" rows="8" cols="40" id="input">
  jQueryScript.Net
</textarea>
<hr>
<input type="button" name="md5" id="md5" value="Generate">
<hr>
<label for="output">Output: </label>
<textarea name="output" rows="8" cols="40" id="output">
  
</textarea>
jQuery(document).ready(function($) {
  $('#md5').click(function(){
    $('#output').val($.MD5($('#input').val()));
  });
});

This awesome jQuery plugin is developed by winai543. For more Advanced Usages, please check the demo page or visit the official website.