PageSourceSearch

https://coins.github.io/hash-js/src/ripemd/ripemd160.js

js coins.github.io collected 2026-10-03 08:49:57 UTC 776 bytes, 24 lines download raw bytes

1// TODO: Port this implementation (because it looks much cleaner) https://github.com/openssl/openssl/tree/master/crypto/ripemd
2
3import { RIPEMD } from './ripemd160-impl-1.js'
4
5/**
6 *
7 * Computes the RIPEMD160 hash of an input
8 * @param {ArrayBuffer} buffer The input
9 * @return {Promise<Uint8Array>} The hash of the input
10 *
11 */
12export function ripemd160(buffer) {
13    const hash = RIPEMD.hash(new Uint8Array(buffer).buffer)
14    return Promise.resolve(hash); // We wrap the result into a promise to stay consistent with the interfaces of all our SHA hash functions 
15}
16
17import { instanciateClass } from '../hash-utils.js'
18const RIPEMD_HASH_LENGTH = 20
19
20/**
21 * Class for RIPEMD160 hashes
22 * @type Hash
23 */
24export const RIPEMD160 = instanciateClass(ripemd160, RIPEMD_HASH_LENGTH)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.