Socket
Socket
Sign inDemoInstall

stream-md5

Package Overview
Dependencies
0
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    stream-md5

MD5 implementation in JS that allows progressive hashing and is binary safe


Version published
Weekly downloads
2K
decreased by-6.6%
Maintainers
1
Install size
173 kB
Created
Weekly downloads
 

Readme

Source

Allows you to stream md5 data and hash at the very end which is very efficient when working with files. This file is based off Joseph Myers' version found at http://www.myersdaily.org/joseph/javascript/md5-text.html.

The progressive portion is based off PHP's implementation. See http://php.net/manual/en/function.hash-init.php

Notes

  • If you pass an array, we look at the first element to determine if its an array of characters or of bytes.
  • Buffers are assumed to contain bytes.
  • You cannot mix types in a progressive state. (This will be fixed in a later version)

Examples

//to hash a single string
var hash = StreamMD5.hash("test")
//098f6bcd4621d373cade4e832627b4f6
//for streaming data
var state = StreamMD5.init();
while (something) {
    StreamMD5.update(state, string);
}
var hash = StreamMD5.finalize(state);

Todo

  • Support streams

Keywords

FAQs

Last updated on 10 Jun 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc