fix aes
This commit is contained in:
parent
01b4d5c207
commit
2d86155a88
@ -22,7 +22,7 @@ test() ->
|
|||||||
|
|
||||||
%% 基于aes的加密算法, aes_256_cbc
|
%% 基于aes的加密算法, aes_256_cbc
|
||||||
-spec encrypt(binary(), binary()) -> binary().
|
-spec encrypt(binary(), binary()) -> binary().
|
||||||
encrypt(Key, PlainText) when is_binary(Key), is_binary(PlainText), byte_size(PlainText) >= 32 ->
|
encrypt(Key, PlainText) when is_binary(Key), is_binary(PlainText) ->
|
||||||
IV = binary:part(Key, {0, 16}),
|
IV = binary:part(Key, {0, 16}),
|
||||||
crypto:crypto_one_time(aes_256_cbc, Key, IV, PlainText, [{encrypt, true}, {padding, pkcs_padding}]).
|
crypto:crypto_one_time(aes_256_cbc, Key, IV, PlainText, [{encrypt, true}, {padding, pkcs_padding}]).
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user