Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Nettle
nettle
Commits
ecf988cd
Commit
ecf988cd
authored
Jun 16, 2001
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
Rev: src/nettle/testsuite/twofish-test.m4:1.1
parent
58dac9f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
testsuite/twofish-test.m4
testsuite/twofish-test.m4
+52
-0
No files found.
testsuite/twofish-test.m4
0 → 100644
View file @
ecf988cd
#include "twofish.h"
BEGIN_TEST
struct twofish_ctx ctx;
uint8_t msg[TWOFISH_BLOCK_SIZE];
uint8_t cipher[TWOFISH_BLOCK_SIZE];
uint8_t clear[TWOFISH_BLOCK_SIZE];
/* 128 bit key */
H(msg, "0000000000000000 0000000000000000");
twofish_set_key(&ctx, 16, H("0000000000000000 0000000000000000"))
twofish_encrypt(&ctx, TWOFISH_BLOCK_SIZE, cipher, msg);
if (!MEMEQ(TWOFISH_BLOCK_SIZE, cipher,
H("9F589F5CF6122C32 B6BFEC2F2AE8C35A")))
FAIL;
twofish_decrypt(&ctx, TWOFISH_BLOCK_SIZE, clear, cipher);
if (!MEMEQ(TWOFISH_BLOCK_SIZE, msg, clear))
FAIL;
/* 192 bit key */
twofish_set_key(&ctx, 24, H("0123456789ABCDEF FEDCBA9876543210"
"0011223344556677"));
twofish_encrypt(&ctx, TWOFISH_BLOCK_SIZE, cipher, msg);
if (!MEMEQ(TWOFISH_BLOCK_SIZE, cipher,
H("CFD1D2E5A9BE9CDF 501F13B892BD2248")))
FAIL;
twofish_decrypt(&ctx, TWOFISH_BLOCK_SIZE, clear, cipher);
if (!MEMEQ(TWOFISH_BLOCK_SIZE, msg, clear))
FAIL;
/* 256 bit key */
twofish_set_key(&ctx, 32, H("0123456789ABCDEF FEDCBA9876543210"
"0011223344556677 8899AABBCCDDEEFF"));
FAIL;
twofish_encrypt(&ctx, TWOFISH_BLOCK_SIZE, cipher, msg);
if (!MEMEQ(TWOFISH_BLOCK_SIZE, cipher,
H("37527BE0052334B8 9F0CFCCAE87CFA20")))
FAIL;
twofish_decrypt(&ctx, TWOFISH_BLOCK_SIZE, clear, cipher);
if (!MEMEQ(TWOFISH_BLOCK_SIZE, msg, clear))
FAIL;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment