feat: crypto library, Nexus HTTP server, JWT CLI, Boko web framework
- lib/crypto/: 9-module crypto library (Hash, HMAC, Base64/URL, Random, AES, RSA, ECDSA, Ed25519, JWT) - rt/runtime.c: +346 lines OpenSSL crypto primitives (SHA-1/384/512, HMAC, Base64URL, AES-CBC/GCM, RSA, ECDSA, Ed25519) - apps/nexus/: multi-threaded HTTP/1.1 + HTTP/2 detect + WebSocket server - apps/jwt-pitbul/: JWT CLI tool (sign, verify, decode, keygen) - apps/boko-framework/: FastAPI-inspired async web framework - test_crypto/: crypto library test suite (23 tests)
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// =============================================================================
|
||||
// Std::Crypto::Base64 — Base64 and Base64URL encode/decode
|
||||
// =============================================================================
|
||||
module Std::Crypto::Base64 {
|
||||
|
||||
import Std::String::{String_Len};
|
||||
|
||||
extern func bux_base64_encode(data: String, len: int) -> String;
|
||||
extern func bux_base64_decode(data: String, len: int, outlen: *int) -> String;
|
||||
extern func bux_base64url_encode(data: String, len: int) -> String;
|
||||
extern func bux_base64url_decode(data: String, len: int, outlen: *int) -> String;
|
||||
|
||||
// --- Standard Base64 ---
|
||||
|
||||
func Base64_Encode(s: String) -> String {
|
||||
return bux_base64_encode(s, String_Len(s) as int);
|
||||
}
|
||||
|
||||
func Base64_Decode(s: String) -> String {
|
||||
let outlen: int = 0;
|
||||
return bux_base64_decode(s, String_Len(s) as int, &outlen);
|
||||
}
|
||||
|
||||
// --- Base64URL (RFC 4648 §5, uses - and _ instead of + and /, no padding) ---
|
||||
|
||||
func Base64URL_Encode(s: String) -> String {
|
||||
return bux_base64url_encode(s, String_Len(s) as int);
|
||||
}
|
||||
|
||||
func Base64URL_Decode(s: String) -> String {
|
||||
let outlen: int = 0;
|
||||
return bux_base64url_decode(s, String_Len(s) as int, &outlen);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user