\href{https://www.npmjs.org/package/hash-base}{\texttt{ }} \href{https://travis-ci.org/crypto-browserify/hash-base}{\texttt{ }} \href{https://david-dm.org/crypto-browserify/hash-base\#info=dependencies}{\texttt{ }}

\href{https://github.com/feross/standard}{\texttt{ }}

Abstract base class to inherit from if you want to create streams implementing the same API as node crypto \href{https://nodejs.org/api/crypto.html\#crypto_class_hash}{\texttt{ Hash}} (for \href{https://nodejs.org/api/crypto.html\#crypto_class_cipher}{\texttt{ Cipher}} / \href{https://nodejs.org/api/crypto.html\#crypto_class_decipher}{\texttt{ Decipher}} check \href{https://github.com/crypto-browserify/cipher-base}{\texttt{ crypto-\/browserify/cipher-\/base}}).\hypertarget{md_sfcode_node_modules_hash_base_README_autotoc_md11583}{}\doxysection{Example}\label{md_sfcode_node_modules_hash_base_README_autotoc_md11583}

\begin{DoxyCode}{0}
\DoxyCodeLine{const HashBase = require('hash-\/base')}
\DoxyCodeLine{const inherits = require('inherits')}
\DoxyCodeLine{}
\DoxyCodeLine{// our hash function is XOR sum of all bytes}
\DoxyCodeLine{function MyHash () \{}
\DoxyCodeLine{  HashBase.call(this, 1) // in bytes}
\DoxyCodeLine{}
\DoxyCodeLine{  this.\_sum = 0x00}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{inherits(MyHash, HashBase)}
\DoxyCodeLine{}
\DoxyCodeLine{MyHash.prototype.\_update = function () \{}
\DoxyCodeLine{  for (let i = 0; i < this.\_block.length; ++i) this.\_sum \string^= this.\_block[i]}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{MyHash.prototype.\_digest = function () \{}
\DoxyCodeLine{  return this.\_sum}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{const data = Buffer.from([ 0x00, 0x42, 0x01 ])}
\DoxyCodeLine{const hash = new MyHash().update(data).digest()}
\DoxyCodeLine{console.log(hash) // => 67 }

\end{DoxyCode}
 You also can check \href{index.js}{\texttt{ source code}} or \href{https://github.com/crypto-browserify/md5.js}{\texttt{ crypto-\/browserify/md5.\+js}}\hypertarget{md_sfcode_node_modules_hash_base_README_autotoc_md11584}{}\doxysection{LICENSE}\label{md_sfcode_node_modules_hash_base_README_autotoc_md11584}
MIT 