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

md5-node-cg-lib

v0.0.11

Published

Library to create MD5 ids

Downloads

6

Readme

N|Solid

md5-node-cg-lib

1. Introduction

This library allows us to create an id md5 or, the creation of this md5 can with information in any encoding or any encoding and convert it to utf8, in the same way this library allows us to validate the integrity of the information by validating the id md5 with one new from the information that you want to validate

2. Library usage

The library can be installed from npm page with the next: npm install md5-node-cg-lib, npm i md5-node-cg-lib or yarn install md5-node-cg-lib

2.1 Library Methods

Method getMd5ID

This method creates the md5 id, without validations, only create id with any parameter

Example:
const data = getMd5ID("Hello World");
//Result will be id md5
b10a8db164e0754105b7a99be72e3fe5

Method createSum

This method creates the md5 id with the method getMd5ID, but it validates data before send to the method getMd5ID, this method receives two arguments, first is the data to create id in any encoding, and the second parameter is flag, the flag is optional, the flag is value to the operation in components like sftp, ftp, ftps, and amazon aws, these components can create id, but only with the flag GETFILE, other flags are not valid.

Examples:
//Creating md5 id without flag
console.log(createSum("ZWZyZnI="))
console.log(createSum("ZWZyZnI"))
//Result same md5 id
361df7e337886f73e12e96dc186c78ec
361df7e337886f73e12e96dc186c78ec

//Example using flag
console.log(JSON.stringify(createSum("ZWZyZnI", flags.CREATEDIRECTORY)))
console.log(createSum("ZWZyZnI=", flags.GETFILE))
//Result, if flag is not valid, the output will be a string empty
""
361df7e337886f73e12e96dc186c78ec

Method checkSumMD5

This method check integrity of data, receives two arguments the first is msg and second is cfg, these parameters are received from the components, the validation is with property md5sum and content.

  • If msg and cfg not contains property md5sum the result is true because we don’t have any to validate.
  • If msg or cfg contains md5sum but not contains property content, result will be false, because we need property content to validate integrity.
  • If msg or cfg contains both properties ‘md5sum’ and ‘content’, we can validate integrity the data creating md5id with property content with encoding utf8 and comparing this id with the id from the property md5sum, if both ids are the same the result will be can true, if not result will be can false.
Example:
const data = {
  content: 'ZWZyZnI=',
  md5sum: '361df7e337886f73e12e96dc186c78ec'
};

console.log('Result is:', checkSumMD5({data}, {}));
//The result is Boolean
Result is: true