RIPEMD160, a cryptographic hash function.
This library belongs to noble crypto
noble-crypto — high-security, easily auditable set of contained cryptographic libraries and tools.
- No dependencies, one small file
- Easily auditable TypeScript/JS code
- Uses es2019 bigint. Supported in Chrome, Firefox, node 10+
- All releases are signed and trusted
- Check out all libraries: secp256k1, ed25519, ripemd160, secretbox-aes-gcm
npm install noble-ripemd160
import ripemd160 from "noble-ripemd160"; const raw = ripemd160(""); // Raw string usage // "9c1185a5c5e9fc54612808977ee8f548b2258d31" const uint = ripemd160(new Uint8Array([97, 98, 99])); // TypedArray usage // Uint8Array [ // 142, 178, 8, 247, // 224, 93, 152, 122, // 155, 4, 74, 142, // 152, 198, 176, 135, // 241, 90, 11, 252 // ] // (typed array representation of "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc")
ripemd160(message: string): string
ripemd160(message: Uint8Array): Uint8Array
message: Message which will be hashed
- Function output type would match the input type.
Noble is production-ready & secure. Our goal is to have it audited by a good security expert.
- JIT-compiler and Garbage Collector make "constant time" extremely hard to achieve in a scripting language.
- Which means any other JS library doesn't use constant-time bigints. Including bn.js or anything else. Even statically typed Rust, a language without GC, makes it harder to achieve constant-time for some cases.
- Overall they are quite rare; for our particular usage they're unimportant. If your goal is absolute security, don't use any JS lib — including bindings to native ones. Try LibreSSL & similar low-level libraries & languages.
- We however consider infrastructure attacks like rogue NPM modules very important; that's why it's crucial to minimize the amount of 3rd-party dependencies & native bindings. If your app uses 500 dependencies, any dep could get hacked and you'll be downloading rootkits with every
npm install. Our goal is to minimize this attack vector.
MIT (c) Paul Miller (https://paulmillr.com), see LICENSE file.