first failing version :)

This commit is contained in:
Dan Buch 2009-11-25 17:10:32 -05:00
parent fc7f35452a
commit a2ef4ba0b1
4 changed files with 53 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.pyc

View File

@ -0,0 +1,8 @@
def encode(msg, pad):
return msg
def decode(msg, pad):
return msg

View File

@ -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())

View File

@ -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'