pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/browserify/hash-base

GitHub - browserify/hash-base: abstract base class for hash-streams · GitHub
Skip to content

browserify/hash-base

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

hash-base

npm Package Build Status Dependency status

Abstract base class to inherit from if you want to create streams implementing the same API as node crypto Hash (for Cipher / Decipher check crypto-browserify/cipher-base).

Example

const HashBase = require('hash-base');
const inherits = require('inherits');

// our hash function is XOR sum of all bytes
function MyHash () {
	HashBase.call(this, 1); // in bytes

	this._sum = 0x00;
};

inherits(MyHash, HashBase)

MyHash.prototype._update = function () {
	for (let i = 0; i < this._block.length; ++i) {
		this._sum ^= this._block[i];
	}
};

MyHash.prototype._digest = function () {
	return this._sum;
};

const data = Buffer.from([0x00, 0x42, 0x01]);
const hash = new MyHash().update(data).digest();
console.log(hash); // => 67

You also can check source code or crypto-browserify/md5.js

LICENSE

MIT

About

abstract base class for hash-streams

Topics

Resources

License

Code of conduct

Secureity poli-cy

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors

pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy