Added convenience functions
git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@456 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -156,6 +156,12 @@ def cipher(do_encrypt, cipherspec, key, data, iv = None):
|
|||||||
del cipher
|
del cipher
|
||||||
return result
|
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):
|
def hash(hashmethod,data):
|
||||||
from Crypto.Hash import SHA, MD5#, RIPEMD
|
from Crypto.Hash import SHA, MD5#, RIPEMD
|
||||||
hash_class = locals().get(hashmethod.upper(), None)
|
hash_class = locals().get(hashmethod.upper(), None)
|
||||||
|
|||||||
Reference in New Issue
Block a user