Skip to content

Instantly share code, notes, and snippets.

@pingud98
Last active February 11, 2017 18:50
Show Gist options
  • Save pingud98/0feeee91c99e9aae2c9e3457b6aa52bd to your computer and use it in GitHub Desktop.
Save pingud98/0feeee91c99e9aae2c9e3457b6aa52bd to your computer and use it in GitHub Desktop.
Version 1 of One Time Pad specification.
Specification for one time pad use.
One Time Pad must be smaller than 4Gb!
File format for transmission data (cyphertext):
Part 0 - 32 bits, the MD5 hash of the OTP used for encoding (before encoding)
Part 1 - 32 bits, indicating the address of the start bit.
Part 2 - The message, no minimum length imposed.
Message input format: Ascii text (for starters)
File extension to be used .bin
To ensure security, the USB stick must be connected for less than 20 minutes at any time.
This prevents the contents being copied, as it's rather slow!
Encryption process:
0) MD5 hash the OTP and store this in output file part 0.
1) Scan the OTP for the first 1 (binary value >0). This is the start location.
2) Encode the start location in the first 32bits of the output file.
3) Bitwise XOR the message with the OTP to produce the cyphertext.
4) Erase all bits used in the OTP, setting to 0.
5) Output file contains 32 bits of start address and the cyphertext.
6) Erase the original message by writing all bits to 0.
Decryption Process:
0) Compute the MD5 hash of the OTP and confirm this matches input file part 0.
1) Read the first 32 bits of the cyphertext from input file part 1 to obtain position P.
2) Go to P within the OTP.
3) XOR the data from bits 33 onwards of the cyhertext with position P > of the OTP.
4) Erase all bits used in the OTP, setting to 0.
5) Output file contains only the decrypted cyphertext.
6) Display the output file for reading.
7) Erase the output file after reading by writing all bits to 0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment