aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/test
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2010-04-01 06:11:22 +0000
committerErlang/OTP <[email protected]>2010-04-01 06:11:22 +0000
commit39e0191d985078d6e9c12c504370425f1de5a6c5 (patch)
treeb59410869e50ab4fd99fb0f7253405516d7d6cf1 /lib/crypto/test
parent00ee51ffa60db202fa3cf845bd59e9e208251eb1 (diff)
parentb869aef371836879f0dd1c306a90acb5f93f3ad0 (diff)
downloadotp-39e0191d985078d6e9c12c504370425f1de5a6c5.tar.gz
otp-39e0191d985078d6e9c12c504370425f1de5a6c5.tar.bz2
otp-39e0191d985078d6e9c12c504370425f1de5a6c5.zip
Merge branch 'au/crypto' into dev
* au/crypto: Add missing docs for crypto:md4/1 Add des_ecb_encrypt/2 and des_ecb_decrypt/2 to crypto module OTP-8551 au/crypto des_ecb_encrypt/2 and des_ecb_decrypt/2 has been added to the crypto module. The crypto:md4/1 function has been documented.
Diffstat (limited to 'lib/crypto/test')
-rw-r--r--lib/crypto/test/crypto_SUITE.erl34
1 files changed, 29 insertions, 5 deletions
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index 290ef19160..8467ff2274 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -1,19 +1,19 @@
%%
%% %CopyrightBegin%
-%%
-%% Copyright Ericsson AB 1999-2009. All Rights Reserved.
-%%
+%%
+%% Copyright Ericsson AB 1999-2010. All Rights Reserved.
+%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
-%%
+%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
-%%
+%%
%% %CopyrightEnd%
%%
-module(crypto_SUITE).
@@ -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.";