Class Overview
SIMPLE_HASH provides cryptographic hashing functions for Eiffel applications.
All hash outputs are available as both raw bytes and hexadecimal strings.
Creation
Initialize the hasher.
Contracts
SHA-256 Features
SHA-256 produces a 256-bit (32-byte) hash, output as 64 hexadecimal characters.
sha256 (a_input: STRING): STRING
Compute SHA-256 hash and return as lowercase hex string (64 characters).
Contracts
sha256_bytes (a_input: STRING): ARRAY [NATURAL_8]
Compute SHA-256 hash and return as 32-byte array.
Contracts
HMAC-SHA256 Features
HMAC-SHA256 creates a keyed hash for message authentication. Essential for JWT HS256 signatures.
hmac_sha256 (a_key, a_message: STRING): STRING
Compute HMAC-SHA256 and return as lowercase hex string (64 characters).
Contracts
hmac_sha256_bytes (a_key, a_message: STRING): ARRAY [NATURAL_8]
Compute HMAC-SHA256 and return as 32-byte array.
Contracts
MD5 Features (Legacy)
md5 (a_input: STRING): STRING
Compute MD5 hash and return as lowercase hex string (32 characters).
Contracts
md5_bytes (a_input: STRING): ARRAY [NATURAL_8]
Compute MD5 hash and return as 16-byte array.
Contracts
Utility Features
bytes_to_hex (a_bytes: ARRAY [NATURAL_8]): STRING
Convert byte array to lowercase hexadecimal string.
Contracts
hex_to_bytes (a_hex: STRING): ARRAY [NATURAL_8]
Convert hexadecimal string to byte array.
Contracts
Constants
| Constant | Value | Description |
|---|---|---|
Hex_chars |
0123456789abcdef |
Hexadecimal characters for output formatting |