Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
digest-stream
Advanced tools
digest-stream - Simple pass-through stream (RW) which calculates the a crypto digest (sha/md5 hash) of a stream and also the length. Pipe your stream through this to get digest and length. (streams2)
Simple node.js pass-through stream (RW) which calculates the a crypto digest (sha/md5 hash) of a stream and also the length. Pipe your stream through this to get digest and length. (streams2)
npm install digest-stream
Provide a the digest algorithm, optional input encoding, digest encoding, and a listener function when you construct the stream. The listener will be called with the resultant digest and length of the stream just prior to end being emitted.
Since this uses the node.js crypto package, refer to http://nodejs.org/api/crypto.html for the specific options available.
digestStream(algorithm, [inputEncoding,] digestEncoding, [options], listenerFn)
- constructs a new stream instance, the listenerFn will be called prior to the end
event being emitted. inputEncoding
is optional and defaults to binary
if not provided.options
- optional streams optionslistenerFn
function signature is fn(digest, dataLength)
- digest
is the digest for the stream data in the digest encoding format specified when instance was created. dataLength
is the length of the data in the stream (provided for convenience). If listenerFn returns an object that is an instance of Error, then the error will be signaled in the stream.var digestStream = require('digest-stream');
var digest;
var dataLength;
function listenerFn(resultDigest, length) {
digest = resultDigest;
dataLength = length;
}
var dstream = digestStream('sha1', 'hex', listenerFn); // create instance
readstream
.pipe(dstream) // digest and length calculated as it passes through
.pipe(...)
By making this simple pass-through stream which calculates the digest and length of a stream, it becomes really easy to add this functionality to a streaming workflow, just by piping it through this stream, the digest and length will be available prior to end
being fired.
If you have input or ideas or would like to get involved, you may:
FAQs
digest-stream - Simple pass-through stream (RW) which calculates the a crypto digest (sha/md5 hash) of a stream and also the length. Pipe your stream through this to get digest and length. (streams2)
The npm package digest-stream receives a total of 4,518 weekly downloads. As such, digest-stream popularity was classified as popular.
We found that digest-stream demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.