~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/crypto/src/crypto.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2010-03-09 17:34:57 UTC
  • mfrom: (10.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20100309173457-4yd6hlcb2osfhx31
Tags: 1:13.b.4-dfsg-3
Manpages in section 1 are needed even if only arch-dependent packages are
built. So, re-enabled them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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]).
36
39
-export([exor/2]).
115
118
 
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).
118
126
 
119
127
%% -define(IDEA_CBC_ENCRYPT, 34).
120
128
%% -define(IDEA_CBC_DECRYPT, 35).
303
311
%%
304
312
%% Blowfish
305
313
%%
 
314
blowfish_ecb_encrypt(Key, Data) when byte_size(Data) >= 8 ->
 
315
    control_bin(?BF_ECB_ENCRYPT, Key, list_to_binary([Data])).
 
316
 
 
317
blowfish_ecb_decrypt(Key, Data) when byte_size(Data) >= 8 ->
 
318
    control_bin(?BF_ECB_DECRYPT, Key, list_to_binary([Data])).
 
319
 
 
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])).
 
322
 
 
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])).
 
325
 
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])).
308
328
 
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])).
311
331
 
 
332
blowfish_ofb64_encrypt(Key, IVec, Data) when byte_size(IVec) =:= 8 ->
 
333
    control_bin(?BF_OFB64_ENCRYPT, Key, list_to_binary([IVec, Data])).
 
334
 
312
335
%%
313
336
%% AES in cipher feedback mode (CFB)
314
337
%%