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

Richard Andrews bflatmaj7th@REDACTED
Sun Feb 21 05:11:12 CET 2010


On Sun, Feb 21, 2010 at 4:33 AM, Maxim Treskin <zerthurd@REDACTED> wrote:
> 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)]).
...
> 1> cr_util:aes_dec().
> ïQRSTUVWXYZ123456gdfgertehgrfcnyeyuyrfghhhhhdtest
> ok
>
> It is really unexpected for me. Can you help me?

Maybe for a 128-bit cipher you should use a 128-bit key.


More information about the erlang-questions mailing list