This commit is contained in:
anlicheng 2023-06-20 21:32:51 +08:00
parent 01b4d5c207
commit 2d86155a88

View File

@ -22,7 +22,7 @@ test() ->
%% aes的加密算法, aes_256_cbc
-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}),
crypto:crypto_one_time(aes_256_cbc, Key, IV, PlainText, [{encrypt, true}, {padding, pkcs_padding}]).