From 544ed5647d9a89fd2dbd62d56964fa37539bfa11 Mon Sep 17 00:00:00 2001 From: Alexander Uvarov Date: Mon, 1 Mar 2010 02:46:23 +0500 Subject: Add des_ecb_encrypt/2 and des_ecb_decrypt/2 to crypto module --- lib/crypto/test/crypto_SUITE.erl | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'lib/crypto/test') 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, @@ -443,6 +445,28 @@ des_cbc_iter(Config) when is_list(Config) -> ?line m(Cipher, hexstr2bin("e5c7cdde872bf27c43e934008c389c" "0f683788499a7c05f6")). +%% +%% +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) -> -- cgit v1.2.3