Skip to content

Commit

Permalink
test: add new test cases for fastpbkdf2 functionality and remove old …
Browse files Browse the repository at this point in the history
…test file

Signed-off-by: Dengfeng Liu <liudf0716@gmail.com>
  • Loading branch information
liudf0716 committed Nov 13, 2024
1 parent 66fc1c4 commit 65ddb68
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 167 deletions.
28 changes: 28 additions & 0 deletions test_fastpbkdf2.c
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;
}
167 changes: 0 additions & 167 deletions testfastpbkdf2.c

This file was deleted.

0 comments on commit 65ddb68

Please sign in to comment.