feat: add Std::Crypto — SHA-256, HMAC-SHA256, Base64, random bytes

- C runtime (OpenSSL): bux_sha256, bux_hmac_sha256, bux_random_bytes,
  bux_base64_encode, bux_base64_decode, bux_bytes_to_hex
- library/std/Crypto.bux: Crypto_Sha256, Crypto_HmacSha256,
  Crypto_HmacSha256Raw, Crypto_RandomBytes, Crypto_Base64Encode,
  Crypto_Base64Decode
- examples/jwt.bux: full JWT creation with HS256 signature
- Link with -lcrypto in C backend
This commit is contained in:
2026-06-05 21:34:37 +03:00
parent fd9abb12be
commit fe31ddbc4b
6 changed files with 198 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
[Package]
+18
View File
@@ -0,0 +1,18 @@
import Std::Io::{PrintLine};
import Std::Crypto;
func Main() -> int {
PrintLine("SHA256:");
PrintLine(Crypto_Sha256("hello"));
PrintLine("HMAC-SHA256:");
PrintLine(Crypto_HmacSha256("secret", "message"));
PrintLine("Base64 encode:");
PrintLine(Crypto_Base64Encode("hello"));
PrintLine("Random bytes (base64):");
PrintLine(Crypto_RandomBytes(16));
return 0;
}