Hello !
I was expecting :crypto.block_encrypt :aes_ige256
to be symmetric, I don’t get what’s wrong. Can someone enlighten me ?
Here is an example script :
data = <<666::size(256)-unit(8)>>
tmp_aes_key = <<1234567890::size(32)-unit(8)>>
tmp_aes_iv = <<0987654321::size(32)-unit(8)>>
encrypted = :crypto.block_encrypt :aes_ige256, tmp_aes_key, tmp_aes_iv, data
decrypted = :crypto.block_decrypt :aes_ige256, tmp_aes_key, tmp_aes_iv, data
IO.puts "-- Initial Data --"
IO.inspect data
IO.puts "-- Encrypted --"
IO.inspect encrypted
IO.puts "-- Decrypted --"
IO.inspect decrypted
And its output :
-- Initial Data --
<<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...>>
-- Encrypted --
<<13, 146, 170, 197, 88, 244, 100, 48, 180, 234, 28, 168, 36, 10, 88, 225, 15,
232, 33, 201, 90, 37, 54, 105, 155, 70, 166, 40, 128, 12, 107, 11, 234, 61,
80, 202, 89, 18, 222, 125, 127, 133, 98, 236, 28, 107, 254, 155, 130, 223,
...>>
-- Decrypted --
<<200, 243, 4, 223, 10, 44, 240, 101, 171, 77, 103, 159, 39, 239, 138, 91, 108,
248, 162, 162, 228, 170, 138, 113, 98, 56, 248, 183, 167, 19, 123, 243, 162,
144, 214, 253, 136, 98, 37, 210, 14, 108, 56, 31, 33, 222, 148, 228, 183, 8,
...>>
Thanks !