Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sha.js

Package Overview
Dependencies
Maintainers
2
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sha.js - npm Package Compare versions

Comparing version 2.4.5 to 2.4.7

lib/padding.js

2

bin.js

@@ -31,7 +31,5 @@ #! /usr/bin/env node

pipe(argv[0], process.stdin)
} else if (argv.length) {
if (/--help|-h/.test(argv[0])) {
usage()
} else {

@@ -38,0 +36,0 @@ var filename = argv.pop()

var exports = module.exports = function SHA (algorithm) {
algorithm = algorithm.toLowerCase()
algorithm = algorithm.toUpperCase()

@@ -10,7 +10,7 @@ var Algorithm = exports[algorithm]

exports.sha = require('./sha')
exports.sha1 = require('./sha1')
exports.sha224 = require('./sha224')
exports.sha256 = require('./sha256')
exports.sha384 = require('./sha384')
exports.sha512 = require('./sha512')
exports.SHA = require('./lib/sha')
exports.SHA1 = require('./lib/sha1')
exports.SHA224 = require('./lib/sha224')
exports.SHA256 = require('./lib/sha256')
exports.SHA384 = require('./lib/sha384')
exports.SHA512 = require('./lib/sha512')
{
"name": "sha.js",
"version": "2.4.7",
"description": "Streamable SHA hashes in pure javascript",
"version": "2.4.5",
"keywords": [
"sha",
"sha1",
"sha2",
"sha224",
"sha256",
"sha384",
"sha512"
],
"homepage": "https://github.com/crypto-browserify/sha.js",
"license": "MIT",
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
"files": [
"lib",
"index.js",
"bin.js"
],
"main": "./index.js",
"bin": "./bin.js",
"repository": {
"type": "git",
"url": "git://github.com/crypto-browserify/sha.js.git"
"url": "https://github.com/crypto-browserify/sha.js.git"
},
"scripts": {
"lint": "standard",
"test": "npm run lint && npm run unit",
"unit": "tape test/*.js"
},
"dependencies": {
"hash-base": "^3.0.0",
"inherits": "^2.0.1"
},
"devDependencies": {
"buffer": "~2.3.2",
"hash-test-vectors": "^1.3.1",
"standard": "^4.0.0",
"tape": "~2.3.2",
"typedarray": "0.0.6"
},
"bin": "./bin.js",
"scripts": {
"prepublish": "npm ls && npm run unit",
"lint": "standard",
"test": "npm run lint && npm run unit",
"unit": "set -e; for t in test/*.js; do node $t; done;"
},
"author": "Dominic Tarr <dominic.tarr@gmail.com> (dominictarr.com)",
"license": "MIT"
"standard": "^6.0.8",
"tape": "^4.5.1"
}
}
# sha.js
Streamable SHA hashes in pure javascript.
[![NPM Package](https://img.shields.io/npm/v/sha.js.svg?style=flat-square)](https://www.npmjs.org/package/sha.js)
[![Build Status](https://img.shields.io/travis/crypto-browserify/sha.js.svg?branch=master&style=flat-square)](https://travis-ci.org/crypto-browserify/sha.js)
[![Dependency status](https://img.shields.io/david/crypto-browserify/sha.js.svg?style=flat-square)](https://david-dm.org/crypto-browserify/sha.js#info=dependencies)
[![build status](https://secure.travis-ci.org/crypto-browserify/sha.js.png)](http://travis-ci.org/crypto-browserify/sha.js)
[![NPM](http://img.shields.io/npm/v/sha.js.svg)](https://www.npmjs.org/package/sha.js)
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
Node style `SHA` on pure JavaScript.
## Example
``` js
var createHash = require('sha.js')
```js
var shajs = require('sha.js')
var sha256 = createHash('sha256')
var sha512 = createHash('sha512')
console.log(shajs('sha256').update('42').digest('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
console.log(new shajs.SHA256().update('42').digest('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
var h = sha256.update('abc', 'utf8').digest('hex')
console.log(h) //ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad
//LEGACY, do not use in new systems:
var sha0 = createHash('sha')
var sha1 = createHash('sha1')
var sha256stream = shajs('sha256')
sha256stream.end('42')
console.log(sha256stream.read().toString('hex'))
// => 73475cb40a568e8da8a045ced110137e159f890ac4da883b6b17dc651b3a8049
```

@@ -29,27 +29,13 @@

sha.js currently implements:
`sha.js` currently implements:
- SHA (SHA-0) -- **legacy, do not use in new systems**
- SHA-1 -- **legacy, do not use in new systems**
- SHA-224
- SHA-256
- SHA-384
- SHA-512
* sha256
* sha512
* sha1 (legacy, no not use in new systems)
* sha (legacy, no not use in new systems)
## Note
Note, this doesn't actually implement a stream, but wrapping this in a stream is trivial.
but is does update incrementally, so you can hash things larger than ram, and also, since it reuses
the typedarrays, it uses a constant amount of memory (except when using base64 or utf8 encoding,
see code comments)
## Acknowledgements
This work is derived from Paul Johnston's ["A JavaScript implementation of the Secure Hash Algorithm"]
(http://pajhome.org.uk/crypt/md5/sha1.html)
## License
MIT

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc