Hashing and encoding with Irete domain
Irete handles cryptographic operations: hashing, encoding, and unique ID generation.
| Method | Description |
|---|---|
sha256(data) |
SHA-256 hash (64 hex chars) |
sha512(data) |
SHA-512 hash (128 hex chars) |
md5(data) |
MD5 hash (32 hex chars, legacy) |
ayanmo message = "Hello, Ifá!";
// SHA-256 hash
ayanmo hash = Irete.sha256(message);
Irosu.fo("SHA256: " + hash);
// e.g. "a7b9c3d1e5f2..."
// SHA-512 for higher security
ayanmo hash512 = Irete.sha512(message);
Irosu.fo("SHA512: " + Ika.substring(hash512, 0, 32) + "...");
// NEVER store plain passwords!
ayanmo password = "secret123";
// Hash the password
ayanmo hashed = Irete.sha256(password);
Irosu.fo("Stored hash: " + hashed);
// Verify password
ise verify_password(input, stored_hash) {
ayanmo input_hash = Irete.sha256(input);
padap? input_hash == stored_hash;
}
Irosu.fo(verify_password("secret123", hashed)); // otito
Irosu.fo(verify_password("wrong", hashed)); // iro
| Method | Description |
|---|---|
base64_encode(data) |
Encode to Base64 |
base64_decode(data) |
Decode from Base64 |
hex_encode(data) |
Encode to hex string |
hex_decode(data) |
Decode from hex |
ayanmo text = "Hello, World!";
// Base64 encoding
ayanmo encoded = Irete.base64_encode(text);
Irosu.fo("Base64: " + encoded); // "SGVsbG8sIFdvcmxkIQ=="
// Decode back
ayanmo decoded = Irete.base64_decode(encoded);
Irosu.fo("Decoded: " + decoded); // "Hello, World!"
// Hex encoding
ayanmo hex = Irete.hex_encode(text);
Irosu.fo("Hex: " + hex); // "48656c6c6f2c20576f726c6421"
// Generate unique identifiers
ayanmo id1 = Irete.uuid();
ayanmo id2 = Irete.uuid();
Irosu.fo("ID 1: " + id1); // e.g. "550e8400-e29b-41d4-a716-446655440000"
Irosu.fo("ID 2: " + id2); // Different every time
// UUIDs are always unique
Irosu.fo(id1 == id2); // iro (false)
ise generate_token(user_id) {
ayanmo timestamp = Iwori.now();
ayanmo random = Irete.uuid();
ayanmo data = user_id + ":" + timestamp + ":" + random;
// Hash the combination
ayanmo token = Irete.sha256(data);
// Take first 32 chars for shorter token
padap? Ika.substring(token, 0, 32);
}
ayanmo token = generate_token("user123");
Irosu.fo("Auth token: " + token);
// Verify file hasn't been modified
ise file_checksum(path) {
ayanmo content = Odi.read(path);
padap? Irete.sha256(content);
}
// Store checksum with file
ayanmo checksum = file_checksum("important.txt");
Irosu.fo("Checksum: " + checksum);
// Later, verify file is unchanged
ayanmo new_checksum = file_checksum("important.txt");
ti (checksum == new_checksum) {
Irosu.fo("? File integrity verified");
} bib?k? {
Irosu.kigbe("? File was modified!");
}