changeset 28:735c406b4c57

add more tests
author Matt Johnston <matt@ucc.asn.au>
date Mon, 17 Jun 2013 00:09:52 +0800
parents a55d7c2440fd
children 22badb6239e0
files test.py
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/test.py	Sun Jun 16 22:05:55 2013 +0800
+++ b/test.py	Mon Jun 17 00:09:52 2013 +0800
@@ -1,4 +1,4 @@
-#!/Users/matt/tmp/crypto/bin/python
+#!/usr/bin/env python
 
 from Crypto.Cipher import AES
 import hashlib
@@ -20,6 +20,11 @@
 enc_key = 'aabbccddeeffgghh\0\0\0\0'
 indata =  '1234567890123456'
 
+a_key = unhexlify('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')
+bs = unhexlify('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb')
+threes = '33333333333333333333'
+print len(threes)
+
 print "cli_key %s, hex %s" % (cli_key, hexlify(cli_key))
 print "enc_key %s, hex %s" % (enc_key, hexlify(enc_key))
 print "data    %s, hex %s" % (indata, hexlify(indata))
@@ -34,7 +39,10 @@
 h = hmac.new(enc_key, 'D:' + enc, hashlib.sha1).digest()
 print "enc hmac hex %s" % hexlify(h)
 
-h = hmac.new(cli_key, 'H:' + cli_key, hashlib.sha1).digest()
-print "hmac test hex %s" % hexlify(h)
+h = hmac.new(a_key, 'H:' + bs, hashlib.sha1).digest()
+print "hmac test aaaa bbbbhex %s" % hexlify(h)
+
+h = hmac.new(threes, 'H:' + threes, hashlib.sha1).digest()
+print "hmac test aaaa bbbbhex %s" % hexlify(h)