예제 #1
0
 def scramble(self, passwd, seed):
     
     hash4 = None
     try: 
         hash1 = sha1(passwd).digest()
         hash2 = sha1(hash1).digest() # Password as found in mysql.user()
         hash3 = sha1(seed + hash2).digest()
         xored = [ utils.int1read(h1) ^ utils.int1read(h3) 
             for (h1,h3) in zip(hash1, hash3) ]
         hash4 = struct.pack('20B', *xored)
     except StandardError, e:
         raise errors.ProgrammingError('Failed scrambling password; %s' % e)
예제 #2
0
 def handle_header(self, buf):
     """Takes a buffer and readers information from header.
     
     Returns a tuple (pktsize, pktnr)
     """
     pktsize = utils.int3read(buf[0:3])
     pktnr = utils.int1read(buf[3])
     
     return (pktsize, pktnr)