1 /** Practical One-time Pad Library
12 #define MARKER_TO "to:"
13 #define MARKER_BEGIN "--EMOTP_BEGIN--"
14 #define MARKER_END "--EMOTP_END--"
16 /** Packaged up encrypted message, ready for transport. */
17 typedef struct _PACKAGE
35 void add_pad(PAD
*new_pad
)
37 printf("add %.8X\n", (unsigned int)new_pad
);
47 for (p
= pads
; p
; p
= p
->next
)
53 /** Show a list of all loaded pads. */
58 for (p
= pads
; p
; p
= p
->next
)
60 printf("Pad: %s: %s (next=%.8x)\n", p
->name
, p
->local_filename
,
61 (unsigned int)p
->next
);
65 /** Load a pad file from disk, adding to 'pads' global. */
66 void load_pad(char *local_filename
)
71 fp
= fopen("/Volumes/Not Backed Up/otp/otp-dazzlement", "rb");
78 new_pad
= malloc(sizeof(PAD
));
85 new_pad
->local_filename
= strdup(local_filename
);
87 /* TODO: new_pad->offset = */
94 /** Close all pads and free allocated memory. */
99 for (p
= pads
; p
; p
= next
)
102 free(p
->local_filename
);
111 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
112 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
113 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
114 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
115 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");