Package detail

@dashincubator/ripemd160

dashhive78MIT3.0.0

Browser-friendly ripemd160 hasher

string, strings, ripemd160, ripe160

readme

@dashincubator/ripemd160

Fully browser-compatible ripemd160 for JavaScript.

Works just like the other node crypto APIs.

Install

Browser:

<script src="https://unpkg.com/@dashincubator/ripemd160/ripemd160.js"></script>
let RIPEMD160 = window.RIPEMD160;

Node:

npm install --save @dashincubator/ripemd160@2
let RIPEMD160 = require("@dashincubator/ripemd160");

Example

let data = new Uint8Array([52, 50]);

let ripemd160 = RIPEMD160.create();
ripemd160.update(data);

let hash = ripemd160.digest();
console.log(hash);
// Uint8Array(20) [ 13, 240, ... 139, 200 ]

Uint8Array to Hex:

let hex = hash.reduce(function (hex, byte) {
  return hex + byte.toString(16).padStart(2, "0");
}, "");

console.log(hex);
// "0df020ba32aa9b8b904471ff582ce6b579bf8bc8"

String to Uint8Array:

let message = "42";
let utf8Encoder = new TextEncoder();
let data = utf8Encoder.encode(message);

History

This fork is for the purpose of making the package <script>-tag compatible for plain, old browser JavaScript (but not incompatible with node or bundlers)

License & Copyright

MIT

Copyright (c) 2022 AJ ONeal & Dash Incubator \ Copyright (c) 2022 Rod Vagg \ Copyright (c) 2016 crypto-browserify

changelog

3.0.0 (2023-01-27)

Breaking Changes

  • Accept Uint8Array ONLY (no dependency on TextEncoder, support node < 10.0)
  • Output Uint8Array ONLY (no ambiguous type on digest())
  • RIPEMD160.create() (no new, doesn't overwrite default export)
  • Remove cruft (dev deps, junk files)

2.3.0 (2023-01-27)

Trivial Changes

  • fork to @dashincubator/ripemd160
  • Add .create() (avoid new)
  • Vanilla JS support (transpile-free browser compatibility)
  • make Prettier
  • rename index.js to ripemd160.js

2.2.2 (2022-05-03)

Trivial Changes

  • deps-dev: bump mocha from 9.2.2 to 10.0.0 (#14) (2baf969)
  • deps-dev: bump polendina from 2.0.15 to 3.0.0 (9b53e0f)

2.2.1 (2022-04-23)

Bug Fixes

  • remove "files" publish restriction (#13) (6847217)

2.2.0 (2022-04-23)

Features

Trivial Changes

  • no-release: bump actions/checkout from 2.4.0 to 3.0.2 (#11) (cc8235d)
  • no-release: bump actions/setup-node from 2.5.1 to 3.1.1 (#8) (01260c2)

2.1.1 (2022-02-15)

Trivial Changes

  • switch to mocha, use polendina for browser tests (6029a3d)

2.1.0 (2022-02-15)

Features

  • 0.0.0 - remove Buffer & dependencies (0ccc3a4)

Bug Fixes

  • no-release: exec tests with tape (6066daf)
  • src: fix package.json for release and description (1ea5c5e)

Trivial Changes

  • no-release: add auto-release (69d513d)
  • no-release: bump actions/checkout from 2.3.4 to 2.4.0 (#1) (58109e3)
  • no-release: bump actions/setup-node from 2.4.0 to 2.5.1 (#2) (05d10d9)

    2.0.1 / 2016-06-22


  • added LICENSE file.

    2.0.0 / 2016-04-11


  • rewritten, license change BSD-3 to MIT. #13
  • stream support #13

    1.0.1 / 2015-05-05


  • standard formatting

    1.0.0 / 2015-01-14



  • made license clear in package.json
  • deleted Makefile, moved targets to package.json
  • removed terst for assert

    0.2.0 / 2014-03-09


  • removed bower.json and component.json
  • changed 4 spacing to 2
  • returns Buffer type now, input must be Array, Uint8Array, Buffer, or string
  • remove deps: convert-hex and convert-string

    0.1.0 / 2013-11-20


  • changed package name
  • removed AMD support

    0.0.2 / 2013-11-06


  • fixed component.json file

    0.0.1 / 2013-11-03


  • initial release