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:
@@ -0,0 +1 @@
|
||||
[Package]
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user