Skip to content

md5 hash function, it will use crypto module for Node.js and pure JS implementation for browser.

License

Notifications You must be signed in to change notification settings

leonismoe/md5js

Repository files navigation

md5

This package uses node Conditional Exports, if it's imported under Node.js, it will use crypto module to create md5 hash, otherwise use Joseph Myers' pure JavaScript md5 implementation.

For bundlers, webpack supports basic conditional exports since v5-beta18, and Rollup's node resolve plugin supports it since 13.0.0.

Usage

ES Module

import md5 from '@leonismoe/md5';
console.log(md5('Hello')); // => "8b1a9953c4611296a827abf8c47804d7"

CommonJS

const md5 = require('@leonismoe/md5');
console.log(md5('Hello')); // => "8b1a9953c4611296a827abf8c47804d7"

If directly imports in browser (use <script> tag without type="module"), it will define a global function named md5.

Contributors

About

md5 hash function, it will use crypto module for Node.js and pure JS implementation for browser.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published