• This repository has been archived on 26/Sep/2021
  • Stars
    star
    4,537
  • Rank 8,913 (Top 0.2 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 12 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

JavaScript MD5 implementation. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.

JavaScript MD5

Contents

Description

JavaScript MD5 implementation.
Compatible with server-side environments like Node.js, module loaders like RequireJS or webpack and all web browsers.

Usage

Client-side

Install the blueimp-md5 package with NPM:

npm install blueimp-md5

Include the (minified) JavaScript MD5 script in your HTML markup:

<script src="js/md5.min.js"></script>

In your application code, calculate the (hex-encoded) MD5 hash of a string by calling the md5 method with the string as argument:

var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804"

Server-side

The following is an example how to use the JavaScript MD5 module on the server-side with Node.js.

Install the blueimp-md5 package with NPM:

npm install blueimp-md5

Add a file server.js with the following content:

require('http')
  .createServer(function (req, res) {
    // The md5 module exports the md5() function:
    var md5 = require('./md5'),
      // Use the following version if you installed the package with npm:
      // var md5 = require("blueimp-md5"),
      url = require('url'),
      query = url.parse(req.url).query
    res.writeHead(200, { 'Content-Type': 'text/plain' })
    // Calculate and print the MD5 hash of the url query:
    res.end(md5(query))
  })
  .listen(8080, 'localhost')
console.log('Server running at http://localhost:8080/')

Run the application with the following command:

node server.js

Requirements

The JavaScript MD5 script has zero dependencies.

API

Calculate the (hex-encoded) MD5 hash of a given string value:

var hash = md5('value') // "2063c1608d6e0baf80249c42e2be5804"

Calculate the (hex-encoded) HMAC-MD5 hash of a given string value and key:

var hash = md5('value', 'key') // "01433efd5f16327ea4b31144572c67f6"

Calculate the raw MD5 hash of a given string value:

var hash = md5('value', null, true)

Calculate the raw HMAC-MD5 hash of a given string value and key:

var hash = md5('value', 'key', true)

Tests

The JavaScript MD5 project comes with Unit Tests.
There are two different ways to run the tests:

  • Open test/index.html in your browser or
  • run npm test in the Terminal in the root path of the repository package.

The first one tests the browser integration, the second one the Node.js integration.

License

The JavaScript MD5 script is released under the MIT license.

More Repositories

1

jQuery-File-Upload

File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads.
PHP
30,988
star
2

JavaScript-Load-Image

Load images provided as File or Blob objects or via URL. Retrieve an optionally scaled, cropped or rotated HTML img or canvas element. Use methods to parse image metadata to extract IPTC and Exif tags as well as embedded thumbnail images, to overwrite the Exif Orientation value and to restore the complete image header after resizing.
JavaScript
4,428
star
3

Gallery

blueimp Gallery is a touch-enabled, responsive and customizable image & video gallery, carousel and lightbox, optimized for both mobile and desktop web browsers. It features swipe, mouse and keyboard navigation, transition effects, slideshow functionality, fullscreen support and on-demand content loading.
JavaScript
3,727
star
4

Bootstrap-Image-Gallery

This project is deprecated in favor of blueimp Gallery.
HTML
2,837
star
5

JavaScript-Templates

1KB lightweight, fast & powerful JavaScript templating engine with zero dependencies. Compatible with server-side environments like node.js, module loaders like RequireJS and all web browsers.
JavaScript
1,716
star
6

JavaScript-Canvas-to-Blob

JavaScript Canvas to Blob is a function to convert canvas elements into Blob objects.
JavaScript
1,466
star
7

wdio

Docker setup for WebdriverIO with automatic screenshots, image diffing and screen recording support for containerized versions of Chrome and Firefox on Linux, mobile versions of Chrome and Firefox on Android as well as Safari on iOS, Safari on macOS and Edge on Windows.
JavaScript
295
star
8

aws-lambda

Collection of functions for AWS Lambda
JavaScript
270
star
9

jQuery-Image-Gallery

This project is deprecated in favor of blueimp Gallery.
HTML
175
star
10

shell-scripts

A collection of (mostly POSIX compatible) shell scripts.
Shell
135
star
11

nightwatch

This project is deprecated in favor of blueimp/wdio.
134
star
12

mjpeg-server

MJPEG Server implements MJPEG over HTTP using FFmpeg or any other input source capable of piping a multipart JPEG stream to stdout. Its primary use case is providing Webdriver screen recordings.
Go
98
star
13

aws-smtp-relay

SMTP server to relay emails via Amazon SES or Amazon Pinpoint using IAM roles.
Go
74
star
14

record-screen

Node.js screen recording function for remote servers using ffmpeg.
JavaScript
69
star
15

nightwatch-video-recorder

Record videos of Nightwatch.js test sessions. Uses ffmpeg to capture a (remote) webdriver desktop screen.
JavaScript
42
star
16

mailhog-node

A NodeJS library to interact with the MailHog API. MailHog is a stand-in SMTP server for Web and API based SMTP testing.
JavaScript
34
star
17

ffmpeg-image-diff

An image diffing library using FFmpeg. Creates an image showing perceptual differences and returns SSIM data.
JavaScript
30
star
18

chromedriver

Chromedriver Dockerfile
Dockerfile
21
star
19

basedriver

Base Webdriver Dockerfile
Dockerfile
14
star
20

passphrase

Better passwords by combining random words.
Go
13
star
21

phpbb

phpBB Dockerfile
Shell
12
star
22

nightwatch-browserstack

Nightwatch.js module to update BrowserStack session status for failed tests.
JavaScript
11
star
23

adb-record-screen

Screen recording function using Android Debug Bridge (adb).
JavaScript
9
star
24

wdio-screen-commands

Webdriver.io commands to capture and record browser screens.
JavaScript
7
star
25

playwright-example

Example setup for the Playwright end-to-end testing framework. Includes an example email application with file attachment support and tests to cover its functionality.
TypeScript
5
star
26

geckodriver

Geckodriver Dockerfile
Dockerfile
4
star
27

wildcard-redirect

HTTP service to redirect wildcard subdomains of an origin host to a new target host, e.g. *.example.com to *.example.org.
Go
4
star
28

mocha-chrome

mocha-chrome Dockerfile
Shell
3
star
29

blueimp.github.io

blueimp's GitHub projects
3
star
30

phpbb-s3-backup

phpBB S3 Backup Dockerfile
Shell
2
star