Added convenience functions

git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@456 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
oepen
2011-07-29 17:49:40 +00:00
parent 61e93395ba
commit b8ed669d9f

View File

@@ -156,6 +156,12 @@ def cipher(do_encrypt, cipherspec, key, data, iv = None):
del cipher
return result
def encrypt(cipherspec, key, data, iv = None):
return cipher(True, cipherspec, key, data, iv)
def decrypt(cipherspec, key, data, iv = None):
return cipher(False, cipherspec, key, data, iv)
def hash(hashmethod,data):
from Crypto.Hash import SHA, MD5#, RIPEMD
hash_class = locals().get(hashmethod.upper(), None)