npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

yamd5.ts

v1.0.2

Published

Fast MD5 implementation in TypeScript

Downloads

213

Readme

This project has been converted from JavaScript to a TypeScript class published on NPM by Andrew G. Knackstedt

YaMD5 - Yet another MD5 hasher

I needed an MD5 hasher, and as usual I want small code base, and fast.

Originally found md5-o-matic. It was fast but did not work with Unicode strings. Also, I eventually realized it was really based on code from Joseph Myers, which is itself a javascript adapation of the C language version the reference implementation of MD5 in Appendix 3 of RFC 1321.

Then I found SparkMD5, which works with Unicode strings, but at a steep cost to performance on large input strings. Also, glancing at the code I saw avoidable redundancies causing the code base to be larger than needed.

So from this point I set out to write my own version, YaMD5 (sorry, I am not good with naming projects), of course heavily relying on the original code from Joseph Myers, (with modifications to incrementally improve performance as per profiling), and bits from SparkMD5 -- I started to work from SparkMD5 implementation, so there might be code original to SparkMD5 I kept in a few places (like say, code in md5.end() etc.)

Benefits of YaMD5

Usage

One pass:

    const { MD5 } = require('yamd5.ts');

    MD5.hashStr('hello world\n') === "6f5902ac237024bdd0c176cb93063dc4";

Incremental:

    import { MD5 } from 'yamd5.ts';
    const md5Hasher = new MD5();
    ...
    md5Hasher.start();
    md5Hasher.appendStr('hello');
    md5Hasher.appendStr(' ');
    md5Hasher.appendStr('world');
    md5Hasher.appendStr('\n');
    md5Hasher.digest() === '6f5902ac237024bdd0c176cb93063dc4';

License

Given that Joseph Myers has never declared a license for his code, I will assume it is either MIT or Public Domain. There are zero indicators otherwise and he presents the file as if it's freely-usable.

I don't know what license covers Joseph Myers' code (need to find out). In any case, concerning whatever original code I contributed in there:

The MIT License (MIT)

Copyright (C) 2014 Raymond Hill

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.