ripemd-ts
raw JSON → 0.0.2 verified Sat Apr 25 auth: no javascript
RIPEMD hash functions (RIPEMD-160, RIPEMD-128, RIPEMD-256, RIPEMD-320) implemented in TypeScript. Current version 0.0.2 is a pre-release and ships TypeScript type definitions. Notable for providing pure TypeScript implementation of the RIPEMD family of cryptographic hash functions. However, the package appears to be using the TypeScript-library-starter boilerplate and may not be production-ready. No release cadence established. Alternative: ripemd160 (npm) for a more mature JavaScript implementation.
Common errors
error import RIPEMD160 from 'ripemd-ts'; // TypeError: Cannot read properties of undefined ↓
cause Default import not available; library exports only named exports.
fix
import { RIPEMD160 } from 'ripemd-ts';
error const RIPEMD160 = require('ripemd-ts'); // RIPEMD160 is not a constructor ↓
cause require returns the module object, not the constructor directly.
fix
const { RIPEMD160 } = require('ripemd-ts');
error ReferenceError: RIPEMD160 is not defined (when using wrong import syntax in TS) ↓
cause TypeScript not recognizing named import or using default import erroneously.
fix
Ensure import statement uses named export: import { RIPEMD160 } from 'ripemd-ts';
Warnings
gotcha Package is a pre-release (0.0.2) and may have incomplete or buggy implementations. Not audited for cryptographic correctness. ↓
fix Consider using a more mature library like ripemd160 (npm) for production.
gotcha Default import (import X from 'ripemd-ts') is undefined; must use named import. ↓
fix Use import { RIPEMD160 } from 'ripemd-ts'.
deprecated Naming conventions for hash function exports are not standardized; may change in future releases. ↓
fix Monitor changelog for breaking changes.
gotcha Only ESM module format is available in package; CJS require is not directly supported but works via property access (require('ripemd-ts').RIPEMD160). ↓
fix If using CommonJS, use const { RIPEMD160 } = require('ripemd-ts').
Install
npm install ripemd-ts yarn add ripemd-ts pnpm add ripemd-ts Imports
- RIPEMD160 wrong
import RIPEMD160 from 'ripemd-ts'correctimport { RIPEMD160 } from 'ripemd-ts' - RIPEMD128 wrong
const RIPEMD128 = require('ripemd-ts').RIPEMD128correctimport { RIPEMD128 } from 'ripemd-ts' - RIPEMD256 wrong
const RIPEMD256 = require('ripemd-ts')correctimport { RIPEMD256 } from 'ripemd-ts' - RIPEMD320
import { RIPEMD320 } from 'ripemd-ts'
Quickstart
import { RIPEMD160, RIPEMD128, RIPEMD256, RIPEMD320 } from 'ripemd-ts';
const message = 'Hello, world!';
const hash160 = new RIPEMD160().update(message).digest('hex');
console.log('RIPEMD-160:', hash160);
const hash128 = new RIPEMD128().update(message).digest('hex');
console.log('RIPEMD-128:', hash128);
const hash256 = new RIPEMD256().update(message).digest('hex');
console.log('RIPEMD-256:', hash256);
const hash320 = new RIPEMD320().update(message).digest('hex');
console.log('RIPEMD-320:', hash320);