Initial template structure from nostr_core_lib
- Complete C library template with OpenSSL-based crypto - Comprehensive build system (Makefile, build.sh) - Example code and test suite - Documentation and usage guides - Cross-platform compatibility (x64/ARM64) - Production-ready structure for C library projects
This commit is contained in:
@@ -157,23 +157,6 @@ static int test_hmac_vectors() {
|
||||
// PBKDF2 TESTS
|
||||
// =============================================================================
|
||||
|
||||
static int test_pbkdf2_rfc6070_test1() {
|
||||
unsigned char result[20];
|
||||
unsigned char expected[20];
|
||||
|
||||
// RFC 6070 Test Case 1
|
||||
// P = "password", S = "salt", c = 1, dkLen = 20
|
||||
// DK = 0c60c80f961f0e71f3a9b524af6012062fe037a6
|
||||
|
||||
hex_to_bytes("0c60c80f961f0e71f3a9b524af6012062fe037a6", expected, 20);
|
||||
|
||||
nostr_pbkdf2_hmac_sha512((const unsigned char*)"password", 8,
|
||||
(const unsigned char*)"salt", 4,
|
||||
1, result, 20);
|
||||
|
||||
return test_bytes_equal("PBKDF2 RFC6070 Test 1", result, expected, 20);
|
||||
}
|
||||
|
||||
static int test_pbkdf2_bip39_example() {
|
||||
unsigned char result[64];
|
||||
|
||||
@@ -443,12 +426,23 @@ int main() {
|
||||
int passed = 0, total = 0;
|
||||
|
||||
// Run all test suites
|
||||
if (test_sha256_vectors()) passed++; total++;
|
||||
if (test_hmac_vectors()) passed++; total++;
|
||||
if (test_pbkdf2_vectors()) passed++; total++;
|
||||
if (test_bip39_vectors()) passed++; total++;
|
||||
if (test_bip32_vectors()) passed++; total++;
|
||||
if (test_secp256k1_vectors()) passed++; total++;
|
||||
if (test_sha256_vectors()) passed++;
|
||||
total++;
|
||||
|
||||
if (test_hmac_vectors()) passed++;
|
||||
total++;
|
||||
|
||||
if (test_pbkdf2_vectors()) passed++;
|
||||
total++;
|
||||
|
||||
if (test_bip39_vectors()) passed++;
|
||||
total++;
|
||||
|
||||
if (test_bip32_vectors()) passed++;
|
||||
total++;
|
||||
|
||||
if (test_secp256k1_vectors()) passed++;
|
||||
total++;
|
||||
|
||||
// Print final results
|
||||
printf("\n==============================\n");
|
||||
|
||||
Reference in New Issue
Block a user