コード例 #1
0
ファイル: EVP.py プロジェクト: mcepl/M2Crypto
 def __init__(self, algo):
     # type: (str) -> None
     md = getattr(m2, algo, None)  # type: Optional[Callable]
     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)
     else:
         self.md = md()
     self.ctx = m2.md_ctx_new()
     m2.digest_init(self.ctx, self.md)
コード例 #2
0
 def __init__(self, algo):
     # type: (str) -> None
     md = getattr(m2, algo, None)  # type: Optional[Callable]
     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)
     else:
         self.md = md()
     self.ctx = m2.md_ctx_new()
     m2.digest_init(self.ctx, self.md)
コード例 #3
0
 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)
コード例 #4
0
ファイル: sha1.py プロジェクト: 0xkag/M2Crypto
def m2c_sha(iter, txt=txt):
    ctx = m2.md_ctx_new()
    m2.digest_init(ctx, m2.sha1())
    for i in range(iter):
        m2.digest_update(ctx, txt)
    out = m2.digest_final(ctx)
コード例 #5
0
ファイル: sha1.py プロジェクト: xampserver1/M2Crypto
def m2c_sha(iter, txt=txt):
    ctx = m2.md_ctx_new()
    m2.digest_init(ctx, m2.sha1())
    for i in range(iter):
        m2.digest_update(ctx, txt)
    out = m2.digest_final(ctx)
コード例 #6
0
ファイル: crypto.py プロジェクト: pecharmin/dnsviz
 def __init__(self, md):
     self.md = md
     self.ctx = m2.md_ctx_new()
     m2.digest_init(self.ctx, self.md)