diff --git a/otp-arm64 b/otp-arm64 new file mode 100755 index 0000000..fb1b857 Binary files /dev/null and b/otp-arm64 differ diff --git a/otp-x86_64 b/otp-x86_64 new file mode 100755 index 0000000..ea781b1 Binary files /dev/null and b/otp-x86_64 differ diff --git a/otp.c b/otp.c index 1212c2a..251e5fa 100644 --- a/otp.c +++ b/otp.c @@ -331,7 +331,7 @@ int interactive_mode(void) { void show_main_menu(void) { - printf("\n=========================== Main Menu - OTP v0.3.7 ===========================\n\n"); + printf("\n=========================== Main Menu - OTP v0.3.8 ===========================\n\n"); printf(" \033[4mT\033[0mext encrypt\n"); //TEXT ENCRYPT printf(" \033[4mF\033[0mile encrypt\n"); //FILE ENCRYPT @@ -3243,7 +3243,7 @@ int generate_ascii_armor(const char* chksum, uint64_t offset, const unsigned cha strcpy(*ascii_output, "-----BEGIN OTP MESSAGE-----\n"); char temp_line[256]; - snprintf(temp_line, sizeof(temp_line), "Version: v0.3.7\n"); + snprintf(temp_line, sizeof(temp_line), "Version: v0.3.8\n"); strcat(*ascii_output, temp_line); snprintf(temp_line, sizeof(temp_line), "Pad-ChkSum: %s\n", chksum); @@ -4729,51 +4729,72 @@ int handle_add_entropy_to_pad(const char* pad_chksum) { return 1; } - // Get entropy amount - printf("\nEntropy collection options:\n"); - printf(" 1. Recommended (2048 bytes) - Optimal security\n"); - printf(" 2. Minimum (1024 bytes) - Good security\n"); - printf(" 3. Maximum (4096 bytes) - Maximum security\n"); - printf(" 4. Custom amount\n"); - printf("Enter choice (1-4): "); + size_t target_bytes; - char amount_input[10]; - if (!fgets(amount_input, sizeof(amount_input), stdin)) { - printf("Error: Failed to read input\n"); - return 1; - } - - size_t target_bytes = 2048; // Default - int amount_choice = atoi(amount_input); - - switch (amount_choice) { - case 1: - target_bytes = 2048; - break; - case 2: - target_bytes = 1024; - break; - case 3: - target_bytes = 4096; - break; - case 4: - printf("Enter custom amount (512-8192 bytes): "); - char custom_input[32]; - if (!fgets(custom_input, sizeof(custom_input), stdin)) { - printf("Error: Failed to read input\n"); - return 1; - } - - size_t custom_amount = (size_t)atoi(custom_input); - if (custom_amount < 512 || custom_amount > 8192) { - printf("Error: Invalid amount. Must be between 512 and 8192 bytes.\n"); - return 1; - } - target_bytes = custom_amount; - break; - default: - target_bytes = 2048; // Default to recommended - break; + // For TrueRNG, automatically use the full pad size + if (entropy_source == ENTROPY_SOURCE_TRUERNG) { + // Get the pad file size + char pad_path[1024]; + char state_path[1024]; + get_pad_path(pad_chksum, pad_path, state_path); + + struct stat pad_stat; + if (stat(pad_path, &pad_stat) != 0) { + printf("Error: Cannot get pad file size\n"); + return 1; + } + + target_bytes = (size_t)pad_stat.st_size; + printf("\nTrueRNG selected - will enhance entire pad with hardware entropy\n"); + printf("Pad size: %.2f GB (%zu bytes)\n", + (double)target_bytes / (1024.0 * 1024.0 * 1024.0), target_bytes); + } else { + // For other entropy sources, show the selection menu + printf("\nEntropy collection options:\n"); + printf(" 1. Recommended (2048 bytes) - Optimal security\n"); + printf(" 2. Minimum (1024 bytes) - Good security\n"); + printf(" 3. Maximum (4096 bytes) - Maximum security\n"); + printf(" 4. Custom amount\n"); + printf("Enter choice (1-4): "); + + char amount_input[10]; + if (!fgets(amount_input, sizeof(amount_input), stdin)) { + printf("Error: Failed to read input\n"); + return 1; + } + + target_bytes = 2048; // Default + int amount_choice = atoi(amount_input); + + switch (amount_choice) { + case 1: + target_bytes = 2048; + break; + case 2: + target_bytes = 1024; + break; + case 3: + target_bytes = 4096; + break; + case 4: + printf("Enter custom amount (512-8192 bytes): "); + char custom_input[32]; + if (!fgets(custom_input, sizeof(custom_input), stdin)) { + printf("Error: Failed to read input\n"); + return 1; + } + + size_t custom_amount = (size_t)atoi(custom_input); + if (custom_amount < 512 || custom_amount > 8192) { + printf("Error: Invalid amount. Must be between 512 and 8192 bytes.\n"); + return 1; + } + target_bytes = custom_amount; + break; + default: + target_bytes = 2048; // Default to recommended + break; + } } printf("\nCollecting %zu bytes of entropy from selected source...\n", target_bytes); @@ -4824,7 +4845,7 @@ int handle_add_entropy_to_pad(const char* pad_chksum) { void print_usage(const char* program_name) { - printf("OTP Cipher - One Time Pad Implementation v0.3.7\n"); + printf("OTP Cipher - One Time Pad Implementation v0.3.8\n"); printf("Built for testing entropy system\n"); printf("Usage:\n"); printf(" %s - Interactive mode\n", program_name);