Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(5)  |  Derive(0)  |  Import(3)

src/b/l/BlueCop-XBMC-Plugins-HEAD/script.module.cryptopy/lib/crypto/keyedHash/hmacHash.py   BlueCop-XBMC-Plugins(Download)
        return self.H_outer(self.k_xor_opad+self.H.digest())
 
from crypto.hash.sha1Hash import SHA1
class HMAC_SHA1(HMAC):
    """ Predefined HMAC built on SHA1 """
    def __init__(self, key = None):
        """ optionally initialize with key """
        HMAC.__init__(self,SHA1,key)

src/b/l/BlueCop-XBMC-Plugins-HEAD/script.module.cryptopy/lib/crypto/keyedHash/hmacHash_test.py   BlueCop-XBMC-Plugins(Download)
import unittest
from crypto.keyedHash.hmacHash import HMAC, HMAC_SHA1
from crypto.hash.sha1Hash      import SHA1
from crypto.hash.md5Hash       import MD5
from binascii                  import a2b_hex, b2a_hex
    def testSHA1_NullKey(self):
        """ HMAC_SHA1 testNullKey """
        ki = ''.join([chr(0x36) for i in range(64)])
        ko = ''.join([chr(0x5C) for i in range(64)])
        h = SHA1()
        keyedHashAlg = HMAC(SHA1,key='')
        ki = chr(ord(ki[0])^0xFF)+ ki[1:]
        ko = chr(ord(ko[0])^0xFF)+ ko[1:]
        h = SHA1()
        keyedHashAlg = HMAC(SHA1,chr(0xff))
        assert ( keyedHashAlg('') == h(ko+h(ki)) ), 'one byte key, Null data test'

src/b/l/BlueCop-XBMC-Plugins-HEAD/script.module.cryptopy/lib/crypto/hash/sha1Hash_test.py   BlueCop-XBMC-Plugins(Download)
"""
 
from   crypto.hash.sha1Hash import SHA1
import unittest
import struct
    def testFIPS180_1_Appendix_A(self):
        """ APPENDIX A.  A SAMPLE MESSAGE AND ITS MESSAGE DIGEST """
        hashAlg = SHA1()
        message        = 'abc'
        message_digest = 0xA9993E36L, 0x4706816AL, 0xBA3E2571L, 0x7850C26CL, 0x9CD0D89DL
    def testFIPS180_1_Appendix_B(self):
        """ APPENDIX B. A SECOND SAMPLE MESSAGE AND ITS MESSAGE DIGEST """
        hashAlg = SHA1()
        message        = 'abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq'
        message_digest = 0x84983E44L, 0x1C3BD26EL, 0xBAAE4AA1L, 0xF95129E5L, 0xE54670F1L
    def testFIPS180_1_Appendix_C(self):
        """ APPENDIX C.   A THIRD SAMPLE MESSAGE AND ITS MESSAGE DIGEST
        Let the message be the binary-coded form of the ASCII string which consists
        of 1,000,000 repetitions of "a". """
        hashAlg = SHA1()