🔒
clib System & Utilities
crypto
Cryptographic functions for PascalAI via OpenSSL native binding. Hash, MAC, symmetric encryption, and random byte generation.
Install ppm install crypto
Usage Example
uses crypto; // Hash functions var h256 := SHA256('hello world'); var h512 := SHA512('hello world'); var md5 := MD5('hello world'); // HMAC authentication var mac := HMAC('sha256', 'my-secret-key', 'message'); // AES encryption/decryption var key := RandomBytes(32); var iv := RandomBytes(16); var enc := AESEncrypt(key, iv, 'sensitive data'); var dec := AESDecrypt(key, iv, enc); // Base64 encoding (crypto-grade) var b64 := Base64Encode(enc); // Secure random bytes var nonce := RandomBytes(12);
Features
SHA256, SHA512, SHA3: secure hash functions
MD5: legacy hash (for compatibility only)
HMAC: keyed-hash message authentication code
AESEncrypt / AESDecrypt: AES-256-CBC symmetric encryption
RandomBytes: cryptographically secure random byte generation
Base64Encode / Base64Decode: binary-to-text encoding
← Back to Package Index