API Reference
The MetaMUI Crypto Primitives library provides a consistent API across all 10 platforms (C, C#, Go, Java, Kotlin, Python, Rust, Swift, TypeScript, WASM) for 33 cryptographic algorithms.
Platform-Specific Documentation
C API
C API with header files and static/dynamic linking support
C# API
C# API with .NET Standard support and NuGet packages
Go API
Go API with modules and goroutine-safe operations
Java API
Java API with Maven/Gradle support and JNI bindings
Kotlin API
Kotlin API documentation with coroutines and Java interop
Python API
Complete Python API reference with type hints and examples
Rust API
Rust API documentation with lifetimes and trait implementations
Swift API
Swift API reference with protocol conformance and error handling
TypeScript API
TypeScript API with full type definitions and async support
WASM API
WebAssembly API for browser and Node.js environments
Common API Patterns
All platforms follow consistent patterns for ease of use:
Key Generation
# Generate keypair
keypair = Algorithm.generate_keypair()
# Access keys
public_key = keypair.public_key
private_key = keypair.private_key
Encryption/Decryption
# Encrypt
ciphertext = Algorithm.encrypt(plaintext, key)
# Decrypt
plaintext = Algorithm.decrypt(ciphertext, key)
Signing/Verification
# Sign
signature = Algorithm.sign(message, private_key)
# Verify
is_valid = Algorithm.verify(signature, message, public_key)
Hashing
# Hash data
hash = Algorithm.hash(data)
# Hash with key (HMAC)
mac = Algorithm.hmac(data, key)
Algorithm Categories
π Post-Quantum Algorithms
- ML-KEM-768: NIST-standardized key encapsulation mechanism
- Dilithium: Lattice-based digital signatures
- Falcon-512: Compact post-quantum signatures
- NTRU Prime: Alternative post-quantum KEM
βοΈ Digital Signatures
- Ed25519: EdDSA over Curve25519
- Ed25519-ZIP215: ZIP-215 compliant Ed25519
- Sr25519: Schnorrkel signatures
π Symmetric Encryption
- AES-256: Advanced Encryption Standard
- ChaCha20: Stream cipher
- ChaCha20-Poly1305: Authenticated encryption
- ARIA-256: Korean standard cipher
- Camellia-256: Japanese standard cipher
#οΈβ£ Hash Functions
- SHA-256/512: Secure Hash Algorithm
- Blake2b/2s: Modern hash functions
- Blake3: Latest Blake variant
- SHAKE-256: Extendable output function
π Key Derivation
- Argon2: Memory-hard password hashing
- PBKDF2: Password-based key derivation
- HKDF: HMAC-based key derivation
π§ Additional Algorithms
- X25519: Elliptic curve Diffie-Hellman
- Poly1305: Message authentication code
- SipHash: Short-input PRF
- HMAC: Hash-based MAC
- HMAC-DRBG: Deterministic random bit generator
- Ascon: Lightweight authenticated encryption
- Deoxys-II: Authenticated encryption
- FlatHash: Fast hashing
- BIP39: Mnemonic phrase generation
Error Handling
All platforms use consistent error handling:
Python
try:
result = Algorithm.operation(data)
except CryptoError as e:
print(f"Crypto error: {e}")
Rust
match algorithm.operation(data) {
Ok(result) => println!("Success: {:?}", result),
Err(e) => eprintln!("Error: {}", e),
}
TypeScript
try {
const result = await Algorithm.operation(data);
} catch (error) {
if (error instanceof CryptoError) {
console.error('Crypto error:', error.message);
}
}
Serialization
All platforms support consistent serialization formats:
- Keys: Hex, Base64, or raw bytes
- Signatures: Fixed-size byte arrays
- Ciphertexts: Include necessary metadata (nonces, tags)
- Hashes: Fixed-size outputs in hex or bytes
Security Considerations
All implementations follow security best practices:
- Constant-time operations for secret data
- Secure memory clearing after use
- Input validation to prevent attacks
- Side-channel resistance in all operations
- No logging of sensitive data
Performance
Each platform is optimized for its environment:
- C: Direct hardware access, minimal overhead, SIMD intrinsics
- C#: JIT compilation, hardware intrinsics via System.Runtime.Intrinsics
- Go: Efficient goroutine scheduling, assembly optimizations
- Java: JIT optimizations, native code via JNI for critical paths
- Kotlin: JVM optimizations and native interop
- Python: Native extensions for performance-critical code
- Rust: Zero-cost abstractions, SIMD when available
- Swift: Leverages Appleβs crypto acceleration
- TypeScript: Optimized WASM modules
- WASM: Efficient memory management and minimal overhead
For detailed platform-specific documentation, select your platform above or browse the complete API documentation.