first failing version :)
This commit is contained in:
parent
fc7f35452a
commit
a2ef4ba0b1
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
*.pyc
|
@ -0,0 +1,8 @@
|
||||
|
||||
|
||||
def encode(msg, pad):
|
||||
return msg
|
||||
|
||||
|
||||
def decode(msg, pad):
|
||||
return msg
|
23
setup.py
23
setup.py
@ -0,0 +1,23 @@
|
||||
import sys
|
||||
from distutils.core import setup
|
||||
|
||||
|
||||
SETUP_ARGS = dict(
|
||||
name='OneTimePad',
|
||||
version='0.1.0',
|
||||
author='Dan Buch',
|
||||
author_email='daniel.buch@gmail.com',
|
||||
url='http://github.com/meatballhat/OneTimePad',
|
||||
description='one-time pad cryptosystem described in "Cryptonomicon"',
|
||||
long_description='',
|
||||
py_modules=['onetimepad'],
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
setup(**SETUP_ARGS)
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main())
|
@ -0,0 +1,21 @@
|
||||
import random
|
||||
|
||||
import unittest
|
||||
import onetimepad as OT
|
||||
|
||||
|
||||
class TestOneTimePad(unittest.TestCase):
|
||||
pad = 'THISISMYONETIMEPADANDITISNOTESPECIALLYBIG' \
|
||||
'BUTITISBIGENOUGHFORMYUSESIFYOUDONTMINDTHX'
|
||||
|
||||
def test_encode(self):
|
||||
enc = OT.encode(IN_MSG, self.pad)
|
||||
self.assertEqual(EXPECTED_ENCODED, enc)
|
||||
|
||||
def test_decode(self):
|
||||
dec = OT.decode(EXPECTED_ENCODED, self.pad)
|
||||
self.assertEqual(IN_MSG, dec)
|
||||
|
||||
|
||||
IN_MSG = 'TWOBYFOURBOARDSONEHUNDREDCOUNTLENGTHEIGHTFEET'
|
||||
EXPECTED_ENCODED = 'huteshusoahutseohusoaeutoaehusoat'
|
Loading…
Reference in New Issue
Block a user