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
e67b8b3b
Commit
e67b8b3b
authored
Nov 28, 2012
by
Fredrik Thulin
Committed by
Niels Möller
Nov 28, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add PBKDF2-HMAC-SHA512 test cases.
parent
1c7d767b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
1 deletion
+32
-1
ChangeLog
ChangeLog
+6
-0
testsuite/pbkdf2-test.c
testsuite/pbkdf2-test.c
+26
-1
No files found.
ChangeLog
View file @
e67b8b3b
2012-11-28 Niels Möller <nisse@lysator.liu.se>
From Fredrik Thulin:
* testsuite/pbkdf2-test.c (test_main): Add PBKDF2-HMAC-SHA512 test
cases.
2012-11-15 Niels Möller <nisse@lysator.liu.se>
* sha3-permute.c (sha3_permute): Use ULL suffix on round
...
...
testsuite/pbkdf2-test.c
View file @
e67b8b3b
...
...
@@ -20,7 +20,7 @@
ASSERT(dk[expect->length] == 17); \
} while (0)
#define MAX_DKLEN
25
#define MAX_DKLEN
SHA512_DIGEST_SIZE
void
test_main
(
void
)
...
...
@@ -28,6 +28,7 @@ test_main (void)
uint8_t
dk
[
MAX_DKLEN
+
1
];
struct
hmac_sha1_ctx
sha1ctx
;
struct
hmac_sha256_ctx
sha256ctx
;
struct
hmac_sha512_ctx
sha512ctx
;
/* Test vectors for PBKDF2 from RFC 6070. */
...
...
@@ -78,6 +79,30 @@ test_main (void)
SHA256_DIGEST_SIZE
,
80000
,
LDATA
(
"NaCl"
),
SHEX
(
"4ddcd8f60b98be21830cee5ef22701f9"
));
/* PBKDF2-HMAC-SHA-512 test vectors confirmed with another
implementation (python-pbkdf2).
>>> from pbkdf2 import PBKDF2
>>> import hmac as HMAC
>>> from hashlib import sha512 as SHA512
>>> PBKDF2("password", "salt", 50, macmodule=HMAC, digestmodule=SHA512).read(64).encode('hex')
*/
hmac_sha512_set_key
(
&
sha512ctx
,
8
,
"password"
);
PBKDF2_TEST
(
&
sha512ctx
,
hmac_sha512_update
,
hmac_sha512_digest
,
SHA512_DIGEST_SIZE
,
1
,
LDATA
(
"NaCL"
),
SHEX
(
"73decfa58aa2e84f94771a75736bb88bd3c7b38270cfb50cb390ed78b305656af8148e52452b2216b2b8098b761fc6336060a09f76415e9f71ea47f9e9064306"
));
hmac_sha512_set_key
(
&
sha512ctx
,
9
,
"pass
\0
word"
);
PBKDF2_TEST
(
&
sha512ctx
,
hmac_sha512_update
,
hmac_sha512_digest
,
SHA512_DIGEST_SIZE
,
1
,
LDATA
(
"sa
\0
lt"
),
SHEX
(
"71a0ec842abd5c678bcfd145f09d83522f93361560563c4d0d63b88329871090e76604a49af08fe7c9f57156c8790996b20f06bc535e5ab5440df7e878296fa7"
));
hmac_sha512_set_key
(
&
sha512ctx
,
24
,
"passwordPASSWORDpassword"
);
PBKDF2_TEST
(
&
sha512ctx
,
hmac_sha512_update
,
hmac_sha512_digest
,
SHA512_DIGEST_SIZE
,
50
,
LDATA
(
"salt
\0\0\0
"
),
SHEX
(
"016871a4c4b75f96857fd2b9f8ca28023b30ee2a39f5adcac8c9375f9bda1ccd1b6f0b2fc3adda505412e79d890056c62e524c7d51154b1a8534575bd02dee39"
));
/* Test convenience functions. */
PBKDF2_HMAC_TEST
(
pbkdf2_hmac_sha1
,
LDATA
(
"password"
),
1
,
LDATA
(
"salt"
),
...
...
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