aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/test
diff options
context:
space:
mode:
authorAlexander Uvarov <[email protected]>2010-03-01 02:46:23 +0500
committerBjörn Gustavsson <[email protected]>2010-03-01 14:36:43 +0100
commit544ed5647d9a89fd2dbd62d56964fa37539bfa11 (patch)
treee704acc8166dae32b0a3d0591b22599187df86b7 /lib/crypto/test
parentd7044099b8da0e5ea38b46764fd005698dc8c612 (diff)
downloadotp-544ed5647d9a89fd2dbd62d56964fa37539bfa11.tar.gz
otp-544ed5647d9a89fd2dbd62d56964fa37539bfa11.tar.bz2
otp-544ed5647d9a89fd2dbd62d56964fa37539bfa11.zip
Add des_ecb_encrypt/2 and des_ecb_decrypt/2 to crypto module
Diffstat (limited to 'lib/crypto/test')
-rw-r--r--lib/crypto/test/crypto_SUITE.erl24
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 290ef19160..636b7f4594 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -40,6 +40,7 @@
md5_mac_io/1,
des_cbc/1,
des_cbc_iter/1,
+ des_ecb/1,
aes_cfb/1,
aes_cbc/1,
aes_cbc_iter/1,
@@ -78,6 +79,7 @@ all(suite) ->
aes_cbc,
aes_cbc_iter,
des_cbc_iter,
+ des_ecb,
rand_uniform_test,
rsa_verify_test,
dsa_verify_test,
@@ -445,6 +447,28 @@ des_cbc_iter(Config) when is_list(Config) ->
%%
%%
+des_ecb(doc) ->
+ "Encrypt and decrypt according to ECB DES and check the result. "
+ "Example are from FIPS-81.";
+des_ecb(suite) ->
+ [];
+des_ecb(Config) when is_list(Config) ->
+ ?line Key = hexstr2bin("0123456789abcdef"),
+ ?line Cipher1 = crypto:des_ecb_encrypt(Key, "Now is t"),
+ ?line m(Cipher1, hexstr2bin("3fa40e8a984d4815")),
+ ?line Cipher2 = crypto:des_ecb_encrypt(Key, "he time "),
+ ?line m(Cipher2, hexstr2bin("6a271787ab8883f9")),
+ ?line Cipher3 = crypto:des_ecb_encrypt(Key, "for all "),
+ ?line m(Cipher3, hexstr2bin("893d51ec4b563b53")),
+ ?line Cipher4 = crypto:des_ecb_decrypt(Key, hexstr2bin("3fa40e8a984d4815")),
+ ?line m(Cipher4, <<"Now is t">>),
+ ?line Cipher5 = crypto:des_ecb_decrypt(Key, hexstr2bin("6a271787ab8883f9")),
+ ?line m(Cipher5, <<"he time ">>),
+ ?line Cipher6 = crypto:des_ecb_decrypt(Key, hexstr2bin("893d51ec4b563b53")),
+ ?line m(Cipher6, <<"for all ">>).
+
+%%
+%%
aes_cfb(doc) ->
"Encrypt and decrypt according to AES CFB 128 bit and check "
"the result. Example are from NIST SP 800-38A.";