예제 #1
0
    def OnButtonCheckED(self, event):
        c = 'utf8'
        dlg = str(self.inputD.GetValue())
        with open(dlg, 'rb') as EDfile:
            p = EDfile.read()
        src = str(p)
        m1 = md5.new()
        m1.update(src)
        self.Md5.SetValue(m1.hexdigest().decode(c))

        m2 = _sha.new()
        m2.update(src)
        self.sha1.SetValue(m2.hexdigest().decode(c))

        m3 = _sha256.sha224()
        m3.update(src)
        self.sha224.SetValue(m3.hexdigest().decode(c))

        m4 = _sha256.sha256()
        m4.update(src)
        self.sha256.SetValue(m4.hexdigest().decode(c))

        m5 = _sha512.sha384()
        m5.update(src)
        self.sha384.SetValue(m5.hexdigest().decode(c))

        m6 = _sha512.sha512()
        m6.update(src)
        self.sha512.SetValue(m6.hexdigest().decode(c))
예제 #2
0
    def OnButtonCheck1(self, event):
        src = str(self.inputN.GetValue().encode('utf8'))
        m1 = md5.new()
        m1.update(src)
        self.Md5.SetValue(m1.hexdigest().decode('utf8'))

        m2 = _sha.new()
        m2.update(src)
        self.sha1.SetValue(m2.hexdigest().decode('utf8'))

        m3 = _sha256.sha224()
        m3.update(src)
        self.sha224.SetValue(m3.hexdigest().decode('utf8'))

        m4 = _sha256.sha256()
        m4.update(src)
        self.sha256.SetValue(m4.hexdigest().decode('utf8'))

        m5 = _sha512.sha384()
        m5.update(src)
        self.sha384.SetValue(m5.hexdigest().decode('utf8'))

        m6 = _sha512.sha512()
        m6.update(src)
        self.sha512.SetValue(m6.hexdigest().decode('utf8'))
 def OnButtonCheckED(self, event):
     c = 'utf8'
     dlg = str(self.inputD.GetValue())
     with open(dlg,'rb') as EDfile:
         p = EDfile.read()
     src = str(p)
     m1 = md5.new()   
     m1.update(src)
     self.Md5.SetValue(m1.hexdigest().decode(c))
     
     m2 = _sha.new()   
     m2.update(src)   
     self.sha1.SetValue(m2.hexdigest().decode(c))
     
     m3 = _sha256.sha224()
     m3.update(src)   
     self.sha224.SetValue(m3.hexdigest().decode(c))
     
     m4 = _sha256.sha256()
     m4.update(src)   
     self.sha256.SetValue(m4.hexdigest().decode(c))
     
     m5 = _sha512.sha384()
     m5.update(src) 
     self.sha384.SetValue(m5.hexdigest().decode(c))  
     
     m6 = _sha512.sha512() 
     m6.update(src)   
     self.sha512.SetValue(m6.hexdigest().decode(c))
 def OnButtonCheck1(self, event):
     src = str(self.inputN.GetValue().encode('utf8'))
     m1 = md5.new()   
     m1.update(src)
     self.Md5.SetValue(m1.hexdigest().decode('utf8'))
     
     m2 = _sha.new()   
     m2.update(src)   
     self.sha1.SetValue(m2.hexdigest().decode('utf8'))
     
     m3 = _sha256.sha224()
     m3.update(src)   
     self.sha224.SetValue(m3.hexdigest().decode('utf8'))
     
     m4 = _sha256.sha256()
     m4.update(src)   
     self.sha256.SetValue(m4.hexdigest().decode('utf8'))
     
     m5 = _sha512.sha384()
     m5.update(src) 
     self.sha384.SetValue(m5.hexdigest().decode('utf8'))  
     
     m6 = _sha512.sha512() 
     m6.update(src)   
     self.sha512.SetValue(m6.hexdigest().decode('utf8'))
예제 #5
0
 def test_sha384_sanity(self):
     x = _sha512.sha384()
     self.assertEqual(x.block_size, 128)
     self.assertEqual(x.digest(),
             "8\xb0`\xa7Q\xac\x968L\xd92~\xb1\xb1\xe3j!\xfd\xb7\x11\x14\xbe\x07CL\x0c\xc7\xbfc\xf6\xe1\xda'N\xde\xbf\xe7oe\xfb\xd5\x1a\xd2\xf1H\x98\xb9[")
     self.assertEqual(x.digest_size, 48)
     self.assertEqual(x.digest_size, x.digestsize)
     self.assertEqual(x.hexdigest(),
             '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b')
     self.assertEqual(x.name, "SHA384")
     x.update("abc")
     self.assertEqual(x.hexdigest(),
             'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7')
     
     x_copy = x.copy()
     self.assertTrue(x!=x_copy)
     self.assertEqual(x.hexdigest(), x_copy.hexdigest())
예제 #6
0
def test_sha384_sanity():
    x = _sha512.sha384()
    AreEqual(x.block_size, 128)
    AreEqual(x.digest(),
             "8\xb0`\xa7Q\xac\x968L\xd92~\xb1\xb1\xe3j!\xfd\xb7\x11\x14\xbe\x07CL\x0c\xc7\xbfc\xf6\xe1\xda'N\xde\xbf\xe7oe\xfb\xd5\x1a\xd2\xf1H\x98\xb9[")
    AreEqual(x.digest_size, 48)
    AreEqual(x.digest_size, x.digestsize)
    AreEqual(x.hexdigest(),
             '38b060a751ac96384cd9327eb1b1e36a21fdb71114be07434c0cc7bf63f6e1da274edebfe76f65fbd51ad2f14898b95b')
    AreEqual(x.name, "SHA384")
    x.update("abc")
    AreEqual(x.hexdigest(),
             'cb00753f45a35e8bb5a03d699ac65007272c32ab0eded1631a8b605a43ff5bed8086072ba1e7cc2358baeca134c825a7')
    
    x_copy = x.copy()
    Assert(x!=x_copy)
    AreEqual(x.hexdigest(), x_copy.hexdigest())
예제 #7
0
파일: hash.py 프로젝트: moreati/stubtool
from ._util import PY2, PY33


if PY2:
    import _md5
    import _sha
    import _sha256
    import _sha512


    md5 = type(_md5.new())
    sha1 = type(_sha.new())
    sha224 = type(_sha256.sha224())
    sha256 = type(_sha256.sha256())
    sha384 = type(_sha512.sha384())
    sha512 = type(_sha512.sha512())
elif PY33:
    import _md5
    import _sha1
    import _sha256
    import _sha512


    md5 = type(_md5.md5())
    sha1 = type(_sha1.sha1())
    sha224 = type(_sha256.sha224())
    sha256 = type(_sha256.sha256())
    sha384 = type(_sha512.sha384())
    sha512 = type(_sha512.sha512())