A pure Elm implementation of Rijndael, the Advanced Encryption Standard (AES).
Based on cl-cryto's aes16.lisp.
Expanded AES encryption and decryption keys.
Created by expandKey
and expandKeyString
. Passed to encryt
and decrypt
.
expandKey : Array Basics.Int -> Result String Keys
Expand a raw key array.
The array's length must be 16, 24, or 32 (128, 192, or 256 bits), and its elements must all be between 0 and 255 inclusive, or you'll get an error.
expandKeyString : String -> Result String Keys
Expand a raw key represented as a string of Hex characters.
All the characters must be in the ranges 0-9, A-F (a-f), and there must be 32, 48, or 64 of them, or your'll get an error.
encrypt : Keys -> Array Basics.Int -> Array Basics.Int
Encrypt the 16-element Array with the Keys.
If the array has other than 16 elements, or any of them are not in the range 0-255, you'll get unexpected results.
decrypt : Keys -> Array Basics.Int -> Array Basics.Int
Decrypt the 16-element Array with the Keys
If the array has other than 16 elements, or any of them are not in the range 0-255, you'll get unexpected results.