Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. import mimetypes
  4. import hashlib
  5. import gzip,zlib
  6. import base64
  7. import binascii
  8. import sys
  9.  
  10. class A801_Hash():
  11. def crypte(password):
  12. saltbytes = [-9, 25, -92, -37, -117, 18, 112, -95, -5,
  13. -108, 40, -83, -107, 73, -92, -102, 46, -52, 49, -118, -79,
  14. -56, -72, 63, -69, -98, -118, -22, 46, -16, -22, -111];
  15. hash=hashlib.sha256(str(password).encode('ISO8859_1')).hexdigest()
  16. h=[]
  17.  
  18. for b in range(0,len(hash)):
  19. h.append(ord(hash[b]))
  20. for b in range(0,len(saltbytes)):
  21. h.append(saltbytes[b]+b)
  22. hexstring=''
  23.  
  24. for b in range(0,len(h)):
  25. test=toHex(h[b],True,2)[4:]
  26. hexstring+=test
  27.  
  28. unhexlify=binascii.unhexlify(hexstring)
  29.  
  30. unhexlifyhashed=(hashlib.sha256(unhexlify).hexdigest())
  31.  
  32. stringbase64HashedOfHashedPwAndSalt=(base64.b64encode(binascii.unhexlify(unhexlifyhashed)))
  33. return stringbase64HashedOfHashedPwAndSalt
  34.  
  35. def toHex(h,f,b):
  36. e = "0123456789abcdef";
  37. d = "";
  38. if (f) :
  39. for c in range(0,4) :
  40. d += e[(h >> ((3 - c) * 8 + 4)) & 15] + e[(h >> ((3 - c) * 8)) & 15]
  41. else :
  42. for a in range(0,4) :
  43. d += e[(h >> (a * 8 + 4)) & 15] + e[(h >> (a * 8)) & 15]
  44. if (b) :
  45. return d[b:]
  46. return d
  47.  
  48. # A801_Hash().crypte("pass")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement