Ìr?t?` 1101

The Keeper — Cryptography

SHA256, Base64, UUID, secure random bytes

Methods

sha256

Irete.sha256(data: String) ? String

Compute SHA-256 hash of input data. Returns hex-encoded string.

ayanmo hash = Irete.sha256("Hello Ifá");
Irosu.fo(hash);
// Output: 8b5a...
let hash = Irete.sha256("Hello Ifá");
Irosu.println(hash);
// Output: 8b5a...

uuid

Irete.uuid() ? String

Generate a new UUID v4 (random).

ayanmo id = Irete.uuid();
Irosu.fo("ID: " + id);
let id = Irete.uuid();
Irosu.println("ID: " + id);

encode_base64 / base64_encode

Irete.encode_base64(data: String) ? String

Encode string to Base64.

ayanmo encoded = Irete.encode_base64("Ifá-Lang");
Irosu.fo(encoded);
// Output: SWbDoS1MYW5n
let encoded = Irete.encode_base64("Ifá-Lang");
Irosu.println(encoded);
// Output: SWbDoS1MYW5n

decode_base64 / base64_decode

Irete.decode_base64(encoded: String) ? String

Decode Base64 string back to original.

ayanmo decoded = Irete.decode_base64("SWbDoS1MYW5n");
Irosu.fo(decoded);
// Output: Ifá-Lang
let decoded = Irete.decode_base64("SWbDoS1MYW5n");
Irosu.println(decoded);
// Output: Ifá-Lang

random_bytes

Irete.random_bytes(count: Int) ? String

Generate cryptographically secure random bytes (hex-encoded).

ayanmo bytes = Irete.random_bytes(16);
Irosu.fo("Random: " + bytes);
let bytes = Irete.random_bytes(16);
Irosu.println("Random: " + bytes);

Complete Example

// Crypto operations example
ayanmo ?r? = "Secret message";

// Hash the message
ayanmo hash = Irete.sha256(?r?);
Irosu.fo("SHA256: " + hash);

// Encode to Base64
ayanmo encoded = Irete.encode_base64(?r?);
Irosu.fo("Base64: " + encoded);

// Generate unique ID
ayanmo id = Irete.uuid();
Irosu.fo("Transaction ID: " + id);

// Generate random key
ayanmo key = Irete.random_bytes(32);
Irosu.fo("Key: " + key);
// Crypto operations example
let message = "Secret message";

// Hash the message
let hash = Irete.sha256(message);
Irosu.println("SHA256: " + hash);

// Encode to Base64
let encoded = Irete.encode_base64(message);
Irosu.println("Base64: " + encoded);

// Generate unique ID
let id = Irete.uuid();
Irosu.println("Transaction ID: " + id);

// Generate random key
let key = Irete.random_bytes(32);
Irosu.println("Key: " + key);