Advertisement
Guest User

TransformiceHash

a guest
Jan 8th, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.72 KB | None | 0 0
  1. # coding: utf-8
  2.  
  3. # Encoder Transformice password
  4. # Author: Xset
  5. # Thanks for the scrypt Weslei.
  6.  
  7. import mimetypes
  8. import hashlib
  9. import gzip,zlib
  10. import base64
  11. import binascii
  12. import sys
  13.  
  14. class CreateHash():
  15.    
  16.     def crypte(self, password):
  17.        
  18.         saltbytes = [-9, 25, -92, -37, -117, 18, 112, -95, -5,
  19.         -108, 40, -83, -107, 73, -92, -102, 46, -52, 49, -118, -79,
  20.         -56, -72, 63, -69, -98, -118, -22, 46, -16, -22, -111];
  21.         hash=hashlib.sha256(str(password).encode('ISO8859_1')).hexdigest()
  22.         h=[]
  23.        
  24.         for b in range(0,len(hash)):
  25.             h.append(ord(hash[b]))
  26.         for b in range(0,len(saltbytes)):
  27.             h.append(saltbytes[b]+b)
  28.         hexstring=''
  29.        
  30.         for b in range(0,len(h)):
  31.             test=self.toHex(h[b],True,2)[4:]
  32.             hexstring+=test
  33.          
  34.         unhexlify=binascii.unhexlify(hexstring)
  35.  
  36.         unhexlifyhashed=(hashlib.sha256(unhexlify).hexdigest())
  37.        
  38.         stringbase64HashedOfHashedPwAndSalt=(base64.b64encode(binascii.unhexlify(unhexlifyhashed)))
  39.  
  40.  
  41.         return stringbase64HashedOfHashedPwAndSalt
  42.  
  43.  
  44.     def toHex(self, h,f,b):
  45.         e = "0123456789abcdef";
  46.         d = "";
  47.         if (f) :
  48.             for c in range(0,4) :
  49.                 d += e[(h >> ((3 - c) * 8 + 4)) & 15] + e[(h >> ((3 - c) * 8)) & 15]
  50.         else :
  51.             for a in range(0,4) :
  52.                 d += e[(h >> (a * 8 + 4)) & 15] + e[(h >> (a * 8)) & 15]
  53.         if (b) :
  54.              return d[b:]
  55.         return d
  56.  
  57. Password = "" # Password
  58. self = CreateHash()
  59. hashpassword = self.crypte(Password)
  60.  
  61. fo = open("foo.txt", "w")
  62. fo.write( str(hashpassword) )
  63. fo.close()
  64.  
  65. print hashpassword
  66. raw_input()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement