diff options
Diffstat (limited to 'node_modules/ripemd160/README.md')
-rw-r--r-- | node_modules/ripemd160/README.md | 105 |
1 files changed, 16 insertions, 89 deletions
diff --git a/node_modules/ripemd160/README.md b/node_modules/ripemd160/README.md index c09f50b19..056c6a212 100644 --- a/node_modules/ripemd160/README.md +++ b/node_modules/ripemd160/README.md @@ -1,100 +1,27 @@ -ripemd160 -========= +# ripemd160 -JavaScript component to compute the RIPEMD-160 hash of strings or bytes. This hash is commonly used in crypto currencies -like Bitcoin. +[](https://www.npmjs.org/package/ripemd160) +[](https://travis-ci.org/crypto-browserify/ripemd160) +[](https://david-dm.org/crypto-browserify/ripemd160#info=dependencies) -Usage ------ +[](https://github.com/feross/standard) -### Install +Node style `ripemd160` on pure JavaScript. - npm install --save ripemd160 - - -### ripemd160(input) - -`input` should be either a `string`, `Buffer`, or an `Array`. It returns a `Buffer`. - -**example 1**: - -```js -var ripemd16 = require('ripemd160') - -var data = 'hello' -var result = ripemd160(data) -console.log(result.toString('hex')) -// => 108f07b8382412612c048d07d13f814118445acd -``` - -**example 2**: +## Example ```js -var ripemd16 = require('ripemd160') +var RIPEMD160 = require('ripemd160') -var data = new Buffer('hello', 'utf8') -var result = ripemd160(data) -console.log(result.toString('hex')) -// => 108f07b8382412612c048d07d13f814118445acd -``` - - -#### Converting Buffers - -If you're not familiar with the Node.js ecosystem, type `Buffer` is a common way that a developer can pass around -binary data. `Buffer` also exists in the [Browserify](http://browserify.org/) environment. Converting to and from Buffers is very easy. - -##### To buffer +console.log(new RIPEMD160().update('42').digest('hex')) +// => 0df020ba32aa9b8b904471ff582ce6b579bf8bc8 -```js -// from string -var buf = new Buffer('some string', 'utf8') - -// from hex string -var buf = new Buffer('3f5a4c22', 'hex') - -// from array -var buf = new Buffer([1, 2, 3, 4]) +var ripemd160stream = new RIPEMD160() +ripemd160stream.end('42') +console.log(ripemd160stream.read().toString('hex')) +// => 0df020ba32aa9b8b904471ff582ce6b579bf8bc8 ``` -#### From buffer - -```js -// to string -var str = buf.toString('utf8') - -// to hex string -var hex = buf.toString('hex') - -// to array -var arr = [].slice.call(buf) -``` - - -Testing -------- - -### Install dev deps: - - npm install --development - -### Test in Node.js: - - npm run test - -### Test in a Browser: - -Testing in the browser uses the excellent [Mochify](https://github.com/mantoni/mochify.js). Mochify can use either PhantomJS -or an actual browser. You must have Selenium installed if you want to use an actual browser. The easiest way is to -`npm install -g start-selenium` and then run `start-selenium`. - -Then run: - - npm run browser-test - - - -License -------- +## LICENSE -Licensed: BSD3-Clause +MIT |