Bundle Cryptographic utilities including AES-256 encryption/decryption, SHA-1/256/512 and MD5 hashing, HMAC signing, and Base64 encoding/decoding. Compile with -lib cipher.
Encrypt
Encrypts data
Operations
AES256 # function
Encrypt input using AES-256
function : AES256(key:Byte[], stream_in:Byte[]) ~ Byte[]Parameters
| Name | Type | Description |
|---|---|---|
| key | Byte | encryption key |
| stream_in | Byte | bytes to encrypted |
Return
| Type | Description |
|---|---|
| Byte | encrypted bytes |
Example
key := "mysecretkey123456789012345678901"->ToByteArray(); # 32 bytes
plain := "Hello World"->ToByteArray();
cipher := Cipher.Encrypt->AES256(key, plain); # encrypt bytes
Cipher.Encrypt->Base64(cipher)->PrintLine(); # show as Base64Base64 # native
Encode input using Base64
function : native : Base64(input:Byte[]) ~ StringParameters
| Name | Type | Description |
|---|---|---|
| input | Byte | bytes to encode |
Return
| Type | Description |
|---|---|
| String | encoded bytes |
Example
bytes := "Hello World"->ToByteArray();
encoded := Cipher.Encrypt->Base64(bytes); # encode to Base64 string
encoded->PrintLine();