-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add new test cases for fastpbkdf2 functionality and remove old …
…test file Signed-off-by: Dengfeng Liu <liudf0716@gmail.com>
- Loading branch information
Showing
2 changed files
with
28 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <stdint.h> | ||
#include "fastpbkdf2.h" | ||
|
||
void print_hex(const uint8_t *data, size_t len) { | ||
for (size_t i = 0; i < len; i++) { | ||
printf("%02x", data[i]); | ||
} | ||
printf("\n"); | ||
} | ||
|
||
void test_fastpbkdf2_hmac_sha1() { | ||
const uint8_t password[] = "password"; | ||
const uint8_t salt[] = "salt"; | ||
uint32_t iterations = 1000; | ||
uint8_t output[20]; // SHA-1 produces a 20-byte hash | ||
|
||
fastpbkdf2_hmac_sha1(password, strlen((const char *)password), salt, strlen((const char *)salt), iterations, output, sizeof(output)); | ||
|
||
printf("PBKDF2-HMAC-SHA1: "); | ||
print_hex(output, sizeof(output)); | ||
} | ||
|
||
int main() { | ||
test_fastpbkdf2_hmac_sha1(); | ||
return 0; | ||
} |
This file was deleted.
Oops, something went wrong.