40 lines
1.9 KiB
Text
40 lines
1.9 KiB
Text
Implement a [[wp:One-time pad|One-time pad]], for encrypting and decrypting messages.<br>
|
|
To keep it simple, we will be using letters only.
|
|
|
|
;Sub-Tasks:
|
|
* '''Generate''' the data for a One-time pad (user needs to specify a filename and length)
|
|
: The important part is to get "true random" numbers, e.g. from /dev/random
|
|
* '''encryption / decryption''' ( basically the same operation, much like [[Rot-13]] )
|
|
: For this step, much of [[Vigenère cipher]] could be reused,<br>with the key to be read from the file containing the One-time pad.
|
|
* optional: '''management''' of One-time pads: list, mark as used, delete, etc.
|
|
: Somehow, the users needs to keep track which pad to use for which partner.
|
|
|
|
To support the management of pad-files:
|
|
* Such files have a file-extension ".1tp"
|
|
* Lines starting with "#" may contain arbitary meta-data (i.e. comments)
|
|
* Lines starting with "-" count as "used"
|
|
* Whitespace within the otp-data is ignored
|
|
<!--
|
|
maybe support for 1tp-files on readonly-media,
|
|
i.e. an indexfile that stores which parts have been used
|
|
-->
|
|
|
|
|
|
For example, here is the data from [http://upload.wikimedia.org/wikipedia/commons/6/60/One-time_pad.svg Wikipedia]:
|
|
<pre>
|
|
# Example data - Wikipedia - 2014-11-13
|
|
-ZDXWWW EJKAWO FECIFE WSNZIP PXPKIY URMZHI JZTLBC YLGDYJ
|
|
-HTSVTV RRYYEG EXNCGA GGQVRF FHZCIB EWLGGR BZXQDQ DGGIAK
|
|
YHJYEQ TDLCQT HZBSIZ IRZDYS RBYJFZ AIRCWI UCVXTW YKPQMK
|
|
CKHVEX VXYVCS WOGAAZ OUVVON GCNEVR LMBLYB SBDCDC PCGVJX
|
|
QXAUIP PXZQIJ JIUWYH COVWMJ UZOJHL DWHPER UBSRUJ HGAAPR
|
|
CRWVHI FRNTQW AJVWRT ACAKRD OZKIIB VIQGBK IJCWHF GTTSSE
|
|
EXFIPJ KICASQ IOUQTP ZSGXGH YTYCTI BAZSTN JKMFXI RERYWE
|
|
</pre>
|
|
<br><br>
|
|
;See also
|
|
* [https://breakingcode.wordpress.com/2010/02/17/one-time-pad-encryption-in-python/ one time pad encryption in Python]
|
|
* [https://github.com/snapfractalpop/1tp snapfractalpop] - One-Time-Pad Command-Line-Utility (C).
|
|
* [http://search.cpan.org/~sifukurt/Crypt-OTP-2.00/OTP.pm Crypt-OTP-2.00] on CPAN (Perl)
|
|
<br><br>
|
|
|