# Class BSV::Primitives::Ripemd160 <a id="class-BSV-Primitives-Ripemd160"></a>

**Inherits:** `Object`

Pure-Ruby implementation of RIPEMD-160.

Ported from the reference C implementation by Hans Dobbertin, Antoon
Bosselaers, and Bart Preneel
(https://homes.esat.kuleuven.be/~bosselae/ripemd160/).

RIPEMD-160 processes data in 512-bit (64-byte) blocks with 80 rounds split
across two parallel paths (left and right). The five 32-bit state words are
initialised to standard IV constants and updated via a Merkle-Damgård
construction with Merkle-Damgård strengthening.

All arithmetic is 32-bit unsigned (masked with 0xFFFFFFFF after additions).

Usage:
    BSV::Primitives::Ripemd160.digest(data) # => 20-byte binary String

## Constants
### `IV` <a id="constant-IV"></a> <a id="IV-constant"></a>
Initial hash values (little-endian words).

### `KL` <a id="constant-KL"></a> <a id="KL-constant"></a>
Left-path round constants (K_l).

### `KR` <a id="constant-KR"></a> <a id="KR-constant"></a>
Right-path round constants (K_r).

### `MASK32` <a id="constant-MASK32"></a> <a id="MASK32-constant"></a>
Mask for 32-bit unsigned arithmetic.

### `RL` <a id="constant-RL"></a> <a id="RL-constant"></a>
Left-path message word selection (rounds 0-79).

### `RR` <a id="constant-RR"></a> <a id="RR-constant"></a>
Right-path message word selection (rounds 0-79).

### `SL` <a id="constant-SL"></a> <a id="SL-constant"></a>
Left-path rotation amounts (rounds 0-79).

### `SR` <a id="constant-SR"></a> <a id="SR-constant"></a>
Right-path rotation amounts (rounds 0-79).

## Public Class Methods
### `digest(data)` <a id="method-c-digest"></a> <a id="digest-class_method"></a>
Compute the RIPEMD-160 digest of `data`.
- **@param** `data` [String] input data (any encoding; treated as binary)
- **@return** [String] 20-byte binary digest (ASCII-8BIT encoding)

## Public Instance Methods
### `digest()` <a id="method-i-digest"></a> <a id="digest-instance_method"></a>
- **@return** [String] 20-byte binary digest

### `initialize(data)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@param** `data` [String] input data
- **@raise** [TypeError] if +data+ is not a String
- **@return** [Ripemd160] a new instance of Ripemd160
