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 /** Show a list of all loaded pads. */
40 for (p
= pads
; p
; p
= p
->next
)
42 printf("Pad: %s: %s\n", p
->name
, p
->local_filename
);
46 /** Load a pad file from disk, adding to 'pads' global. */
47 void load_pad(char *local_filename
)
52 fp
= fopen("/Volumes/Not Backed Up/otp/otp-dazzlement", "rb");
59 new_pad
= malloc(sizeof(PAD
));
66 new_pad
->local_filename
= strdup(local_filename
);
67 new_pad
->name
= strdup("dc"); /* TODO */
68 new_pad
->offset
= -1; /* TODO */
72 /* Add to linked list. */
82 for (p
= pads
; p
; p
= p
->next
)
88 /** Close all pads and free allocated memory. */
93 for (p
= pads
; p
; p
= next
)
96 free(p
->local_filename
);
105 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
106 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
107 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
108 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");
109 load_pad("/Volumes/Not Backed Up/otp/otp-dazzlement");