masprs0x / node-checksum

Checksum utility for Node.js

Home Page:https://www.npmjs.com/package/@litehex/node-checksum

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

node-checksum

Checksum utility for Node.js

Install

npm install --global @litehex/node-checksum

Usage

Usage: cli [options] [command] [file...]

Arguments:
  file                                file to hash (default: [])

Options:
  -a, --algorithm <algorithm>         hash algorithm (default: "sha256")
  -C, --context <context>             context to hash
  --cwd <cwd>                         current working directory (default: ".")
  -h, --help                          display help for command

Commands:
  verify [options] <file> [checksum]  verify checksum

Examples

Generate checksum

$ checksum package.json --algorithm sha256
> b6f69eb6fcf34f5f3e9b34724562b7c6b681f6b2aeefc7909363930febd5da83

$ checksum package.json README.md --algorithm md5
> 85f96e23f8adb7e1b1faf6f6341fe768  package.json
> ddc66b29b08d70b9accaa797d98ccdcc  README.md

$ checksum -C "Hello World" --algorithm md5
> b10a8db164e0754105b7a99be72e3fe5

$ echo -n "Hello World" | checksum --algorithm sha1
> 0a4d55a8d778e5022fab701977c5d840bbc486d0

Verify checksum

$ checksum verify package.json b6f69eb6fcf34f5f3e9b34724562b7c6b681f6b2aeefc7909363930febd5da83
> match

$ echo -n "56bfa638dc6449196cf8110d693b6dab" | checksum verify package.json -a md5
> match

$ echo -n "WRONG" | checksum verify package.json -a md5
> mismatch: expected 56bfa638dc6449196cf8110d693b6dab but got 0a4d55a8d778e5022fab701977c5d840bbc486d0

$ echo -n "WRONG" | checksum verify package.json -a md5 --quiet # exit code 1

License

This project is licensed under the GPLv3 License - see the LICENSE file for details

About

Checksum utility for Node.js

https://www.npmjs.com/package/@litehex/node-checksum

License:GNU General Public License v3.0


Languages

Language:TypeScript 75.3%Language:JavaScript 24.7%