예제 #1
0
 def __init__(self, algo):
     md = getattr(m2, algo, None)
     if md is None:
         raise ValueError, ('unknown algorithm', algo)
     self.md = md()
     self.ctx = m2.md_ctx_new()
     m2.digest_init(self.ctx, self.md)
예제 #2
0
파일: EVP.py 프로젝트: 0xkag/M2Crypto
 def __init__(self, algo):
     md = getattr(m2, algo, None)
     if md is None:
         raise ValueError, ('unknown algorithm', algo)
     self.md=md()
     self.ctx=m2.md_ctx_new()
     m2.digest_init(self.ctx, self.md)
예제 #3
0
파일: EVP.py 프로젝트: pywbem/m2crypto
 def __init__(self, algo):
     md = getattr(m2, algo, None)
     if md is None:
         # if the digest algorithm isn't found as an attribute of the m2
         # module, try to look up the digest using get_digestbyname()
         self.md = m2.get_digestbyname(algo)
         if self.md is None:
             raise ValueError("unknown algorithm", algo)
     else:
         self.md = md()
     self.ctx = m2.md_ctx_new()
     m2.digest_init(self.ctx, self.md)