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'))
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))
# expected: fail # - warnings about PyString_AsString(), since that is allowed to be modified try: import _sha as sha except ImportError: import sha s = sha.new() print s.hexdigest() s.update("aoeu") print s.hexdigest()
from __future__ import absolute_import import _hashlib 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())
try: import _sha as sha except ImportError: import sha s = sha.new() print s.hexdigest() s.update("aoeu") print s.hexdigest()