Coder Social home page Coder Social logo

js-md2's Introduction

js-md2

Build Status Build Status
NPM
A simple MD2 hash function for JavaScript supports UTF-8 encoding.

Demo

MD2 Online

Download

Compress
Uncompress

Installation

You can also install js-md2 by using Bower.

bower install js-md2

For node.js, you can use this command to install:

npm install js-md2

Usage

You could use like this:

md2('Message to hash');

If you use node.js, you should require the module first:

md2 = require('js-md2');

Example

Code

md2('');
md2('The quick brown fox jumps over the lazy dog');
md2('The quick brown fox jumps over the lazy dog.');

Output

8350e5a3e24c153df2275c9f80692773
03d85a0d629d2c442e987525319fc471
71eaa7e440b611e41a6f0d97384b342a

It also supports UTF-8 encoding:

Code

md2('中文');

Output

7af93c270b0ec392ca2f0d90a927cf8a

Extensions

jQuery

If you prefer jQuery style, you can add following code to add a jQuery extension.

Code

jQuery.md2 = md2

And then you could use like this:

$.md2('message');

Prototype

If you prefer prototype style, you can add following code to add a prototype extension.

Code

String.prototype.md2 = function() {
  return md2(this);
};

And then you could use like this:

'message'.md2();

License

The project is released under the MIT license.

Contact

The project's website is located at https://github.com/emn178/js-md2
Author: [email protected]

js-md2's People

Contributors

emn178 avatar josephfinlayson avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.