Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - def pseudopasswd(instr, limit):
 - # null pad odd length string
 - if len(instr) % 2 == 1:
 - instr = instr + chr(0)
 - charset = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789."
 - t1 = 0
 - t2 = 0
 - t3 = 0
 - t4 = 0
 - out = []
 - for i in range(limit):
 - if i == len(instr)/2:
 - break
 - a = ord(instr[2*i])
 - b = ord(instr[2*i+1])
 - t3 = t3 + b & 0xffffffff
 - t5 = t3 ^ t2 & 0xffffffff
 - if (t5 == 0):
 - t5 = 0xe0b8585b
 - t1 = t4 + a ^ t1
 - t1 = t1 & 0xffffffff
 - if (t1 == 0):
 - t1 = 0x9e3779b9
 - t2 = ((t5 & 0xffff) * 0x9069) + (t5 >> 0x10) & 0xffffffff
 - t1 = ((t1 & 0xffff) * 18000) + (t1 >> 0x10) & 0xffffffff
 - t5 = (t2 << 16) + t1 & 0xffffffff
 - t6 = t5 >> 13 ^ (t4 + a - t3) - t5
 - t6 = t6 & 0xffffffff
 - t7 = t6 << 8 ^ (t3 - t5) - t6
 - t7 = t7 & 0xffffffff
 - t4 = t7 >> 13 ^ (t5 - t6) - t7
 - t4 = t4 & 0xffffffff
 - t3 = t4 >> 12 ^ (t6 - t7) - t4
 - t3 = t3 & 0xffffffff
 - t6 = t3 << 16 ^ (t7 - t4) - t3
 - t6 = t6 & 0xffffffff
 - t5 = t6 >> 5 ^ (t4 - t3) - t6
 - t5 = t5 & 0xffffffff
 - t4 = t5 >> 3 ^ (t3 - t6) - t5
 - t4 = t4 & 0xffffffff
 - t3 = t4 << 10 ^ (t6 - t5) - t4
 - t3 = t3 & 0xffffffff
 - tmp = (t5 - t4) - t3 & 0xffffffff
 - idx = (t3 >> 0xf ^ tmp ) % 0x3f
 - out.append(charset[idx])
 - return ''.join(out)
 - limit = 30
 - input = "Pack my box with five dozen liquor jugs. 1234567890"
 - result = pseudopasswd(input, limit)
 - print(result)
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment