Primitivas criptográficas ligeras para el ecosistema Ether. El módulo arranca con hashing de passwords basado en PBKDF2-HMAC-SHA256 y queda organizado para incorporar después HMAC, firmas, key derivation y generación de tokens aleatorios sin mezclarlo con transporte HTTP o lógica de dominio.
Compila bajo el ether-parent actual, alineado con Java 25 y la línea de versión 9.0.0-SNAPSHOT del resto de módulos del ecosistema.
<dependency>
<groupId>dev.rafex.ether.crypto</groupId>
<artifactId>ether-crypto</artifactId>
<version>9.0.0-SNAPSHOT</version>
</dependency>| Package | Purpose |
|---|---|
dev.rafex.ether.crypto |
Entry points and shared crypto APIs |
dev.rafex.ether.crypto.password |
Password hashing and verification |
La separación semántica actual deja la base para crecer con subpaquetes como hmac, signature, kdf y token sin mezclar responsabilidades.
PasswordHasherdefines the contract for password hashing and verification.PasswordHasherPBKDF2ports the PBKDF2 logic used in Kiwi and HouseDB.- Constant-time verification via
MessageDigest.isEqual. - JDK-only implementation using
SecretKeyFactoryandPBEKeySpec.
import dev.rafex.ether.crypto.password.PasswordHasherPBKDF2;
var hasher = new PasswordHasherPBKDF2(32);
byte[] salt = new byte[] {1, 2, 3, 4, 5, 6, 7, 8};
int iterations = 120_000;
var result = hasher.hash("correct horse battery staple".toCharArray(), salt, iterations);
boolean valid = hasher.verify(
"correct horse battery staple".toCharArray(),
result.salt(),
result.iterations(),
result.hash()
);- HMAC helpers
- Signature helpers
- Generic key derivation utilities
- Secure random token generators