[erlang-questions] aes-128-cbc decryption in erlang

Kenji Rikitake <>
Sun Feb 21 04:46:02 CET 2010


For aes_cbc_128_*/3 functions, The length of Key must be 128 bits.
The Key below has 32 bytes aka 256 bits.

Kenji Rikitake

In the message <>
dated Sat, Feb 20, 2010 at 11:33:34PM +0600,
Maxim Treskin <> writes:
> aes_dec() ->
>     Key = <<"ABCDEFGHIJKLMNOPQRSTUVWXYZ123456">>,
>     IVec = <<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>,
>     Text = <<"gdfgertehgrfcnyeyuyrfghhhhhdtest">>,
>     Enc = crypto:aes_cbc_128_encrypt(Key, IVec, Text),
>     Res = crypto:aes_cbc_128_decrypt(Key, IVec, Enc),
>     io:format("Res: ~s~n", [binary_to_list(Res)]).



More information about the erlang-questions mailing list