30
30
-export([md5_mac/2, md5_mac_96/2, sha_mac/2, sha_mac_96/2]).
31
31
-export([des_cbc_encrypt/3, des_cbc_decrypt/3, des_cbc_ivec/1]).
32
32
-export([des3_cbc_encrypt/5, des3_cbc_decrypt/5]).
33
-export([blowfish_cfb64_encrypt/3,blowfish_cfb64_decrypt/3]).
33
-export([blowfish_ecb_encrypt/2, blowfish_ecb_decrypt/2]).
34
-export([blowfish_cbc_encrypt/3, blowfish_cbc_decrypt/3]).
35
-export([blowfish_cfb64_encrypt/3, blowfish_cfb64_decrypt/3]).
36
-export([blowfish_ofb64_encrypt/3]).
34
37
-export([des_ede3_cbc_encrypt/5, des_ede3_cbc_decrypt/5]).
35
38
-export([aes_cfb_128_encrypt/3, aes_cfb_128_decrypt/3]).
116
119
-define(BF_CFB64_ENCRYPT, 59).
117
120
-define(BF_CFB64_DECRYPT, 60).
121
-define(BF_ECB_ENCRYPT, 61).
122
-define(BF_ECB_DECRYPT, 62).
123
-define(BF_OFB64_ENCRYPT, 63).
124
-define(BF_CBC_ENCRYPT, 64).
125
-define(BF_CBC_DECRYPT, 65).
119
127
%% -define(IDEA_CBC_ENCRYPT, 34).
120
128
%% -define(IDEA_CBC_DECRYPT, 35).
314
blowfish_ecb_encrypt(Key, Data) when byte_size(Data) >= 8 ->
315
control_bin(?BF_ECB_ENCRYPT, Key, list_to_binary([Data])).
317
blowfish_ecb_decrypt(Key, Data) when byte_size(Data) >= 8 ->
318
control_bin(?BF_ECB_DECRYPT, Key, list_to_binary([Data])).
320
blowfish_cbc_encrypt(Key, IVec, Data) when byte_size(Data) rem 8 =:= 0 ->
321
control_bin(?BF_CBC_ENCRYPT, Key, list_to_binary([IVec, Data])).
323
blowfish_cbc_decrypt(Key, IVec, Data) when byte_size(Data) rem 8 =:= 0 ->
324
control_bin(?BF_CBC_DECRYPT, Key, list_to_binary([IVec, Data])).
306
326
blowfish_cfb64_encrypt(Key, IVec, Data) when byte_size(IVec) =:= 8 ->
307
327
control_bin(?BF_CFB64_ENCRYPT, Key, list_to_binary([IVec, Data])).
309
329
blowfish_cfb64_decrypt(Key, IVec, Data) when byte_size(IVec) =:= 8 ->
310
330
control_bin(?BF_CFB64_DECRYPT, Key, list_to_binary([IVec, Data])).
332
blowfish_ofb64_encrypt(Key, IVec, Data) when byte_size(IVec) =:= 8 ->
333
control_bin(?BF_OFB64_ENCRYPT, Key, list_to_binary([IVec, Data])).
313
336
%% AES in cipher feedback mode (CFB)