Compare commits

..

2 Commits

14
otp.c
View File

@@ -377,7 +377,7 @@ int list_available_pads(void) {
int count = 0; int count = 0;
printf("Available pads:\n"); printf("Available pads:\n");
printf("%-4s %-20s %-12s %-12s %-8s\n", "No.", "Hash (first 16 chars)", "Size", "Used", "% Used"); printf("%-4s %-20s %-12s %-12s %-8s\n", "No.", "ChkSum (first 16 chars)", "Size", "Used", "% Used");
printf("%-4s %-20s %-12s %-12s %-8s\n", "---", "-------------------", "----------", "----------", "------"); printf("%-4s %-20s %-12s %-12s %-8s\n", "---", "-------------------", "----------", "----------", "------");
while ((entry = readdir(dir)) != NULL) { while ((entry = readdir(dir)) != NULL) {
@@ -455,7 +455,7 @@ int show_pad_info(const char* chksum) {
read_state_offset(chksum, &used_bytes); read_state_offset(chksum, &used_bytes);
printf("=== Pad Information ===\n"); printf("=== Pad Information ===\n");
printf("Hash: %s\n", chksum); printf("ChkSum: %s\n", chksum);
printf("File: %s\n", pad_filename); printf("File: %s\n", pad_filename);
double size_gb = (double)st.st_size / (1024.0 * 1024.0 * 1024.0); double size_gb = (double)st.st_size / (1024.0 * 1024.0 * 1024.0);
@@ -920,9 +920,9 @@ int encrypt_text(const char* pad_identifier) {
} }
// Output in ASCII armor format // Output in ASCII armor format
printf("\n-----BEGIN OTP MESSAGE-----\n"); printf("\n\n-----BEGIN OTP MESSAGE-----\n");
printf("Version: %s\n", get_version()); printf("Version: %s\n", get_version());
printf("Pad-Hash: %s\n", chksum_hex); printf("Pad-ChkSum: %s\n", chksum_hex);
printf("Pad-Offset: %lu\n", current_offset); printf("Pad-Offset: %lu\n", current_offset);
printf("\n"); printf("\n");
@@ -932,7 +932,7 @@ int encrypt_text(const char* pad_identifier) {
printf("%.64s\n", base64_cipher + i); printf("%.64s\n", base64_cipher + i);
} }
printf("-----END OTP MESSAGE-----\n\n"); printf("-----END OTP MESSAGE-----\n\n\n");
// Cleanup // Cleanup
free(pad_data); free(pad_data);
@@ -972,8 +972,8 @@ int decrypt_text(const char* pad_identifier) {
if (!found_begin) continue; if (!found_begin) continue;
if (strncmp(line, "Pad-Hash: ", 10) == 0) { if (strncmp(line, "Pad-ChkSum: ", 12) == 0) {
strncpy(stored_chksum, line + 10, 64); strncpy(stored_chksum, line + 12, 64);
stored_chksum[64] = '\0'; stored_chksum[64] = '\0';
} }
else if (strncmp(line, "Pad-Offset: ", 12) == 0) { else if (strncmp(line, "Pad-Offset: ", 12) == 0) {