项目作者: mingchen

项目描述 :
Secure hash algorithms like md5, sha1, sha2
高级语言: JavaScript
项目地址: git://github.com/mingchen/node-secure-hash.git
创建时间: 2018-04-06T05:09:51Z
项目社区:https://github.com/mingchen/node-secure-hash

开源协议:

下载


node-secure-hash

Build Status Greenkeeper badge

nodejs crypto secure hash collection, just a wrapper of crypto to make more easy to use.

Install

  1. npm install secure-hash

API

  1. class SecureHash {
  2. static md5(data, format='hex');
  3. static sha1(data, format='hex');
  4. static sha256(data, format='hex');
  5. static sha384(data, format='hex');
  6. static sha512(data, format='hex');
  7. static ripemd160(data, format='hex');
  8. }

Usage

  1. > const { SecureHash } = require('secure-hash');
  2. > SecureHash.sha1('The quick brown fox jumps over the lazy dog', 'base64')
  3. 'L9ThxnotKPzthJ7hu3bnORuT6xI='
  4. > SecureHash.sha1('The quick brown fox jumps over the lazy dog', 'binary')
  5. '/ÔáÆz-(ü턞á»vç9\u001b“ë\u0012'
  6. > SecureHash.sha256('The quick brown fox jumps over the lazy dog', 'binary')
  7. 'רû³\u0007׀”iʚ¼°\b.OVQäm<Ûv-\u0002п7Éå’'
  8. > SecureHash.sha256('The quick brown fox jumps over the lazy dog')
  9. 'd7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592'
  10. > SecureHash.sha384('The quick brown fox jumps over the lazy dog')
  11. 'ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1'
  12. > SecureHash.sha512('The quick brown fox jumps over the lazy dog')
  13. '07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6'
  14. > SecureHash.ripemd160('The quick brown fox jumps over the lazy dog')
  15. '37f332f68db77bd9d7edd4969571ad671cf9dd3b'

References