Advertisement
Guest User

Untitled

a guest
Feb 11th, 2023
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.63 KB | None | 0 0
  1. def pseudopasswd(instr, limit):
  2.     # null pad odd length string
  3.     if len(instr) % 2 == 1:
  4.         instr = instr + chr(0)
  5.     charset = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789."
  6.     t1 = 0
  7.     t2 = 0
  8.     t3 = 0
  9.     t4 = 0
  10.     out = []            
  11.     for i in range(limit):
  12.         if i == len(instr)/2:
  13.             break
  14.         a = ord(instr[2*i])
  15.         b = ord(instr[2*i+1])
  16.         t3 = t3 + b & 0xffffffff
  17.         t5 = t3 ^ t2 & 0xffffffff
  18.         if (t5 == 0):
  19.             t5 = 0xe0b8585b
  20.         t1 = t4 + a ^ t1
  21.         t1 = t1 & 0xffffffff
  22.         if (t1 == 0):
  23.             t1 = 0x9e3779b9
  24.         t2 = ((t5 & 0xffff) * 0x9069) + (t5 >> 0x10) & 0xffffffff
  25.         t1 = ((t1 & 0xffff) * 18000) + (t1 >> 0x10) & 0xffffffff
  26.         t5 = (t2 << 16) + t1 & 0xffffffff
  27.         t6 = t5 >> 13 ^ (t4 + a - t3) - t5
  28.         t6 = t6 & 0xffffffff
  29.         t7 = t6 << 8 ^ (t3 - t5) - t6
  30.         t7 = t7 & 0xffffffff
  31.         t4 = t7 >> 13 ^ (t5 - t6) - t7
  32.         t4 = t4 & 0xffffffff
  33.         t3 = t4 >> 12 ^ (t6 - t7) - t4
  34.         t3 = t3 & 0xffffffff
  35.         t6 = t3 << 16 ^ (t7 - t4) - t3
  36.         t6 = t6 & 0xffffffff
  37.         t5 = t6 >> 5 ^ (t4 - t3) - t6
  38.         t5 = t5 & 0xffffffff
  39.         t4 = t5 >> 3 ^ (t3 - t6) - t5
  40.         t4 = t4 & 0xffffffff
  41.         t3 = t4 << 10 ^ (t6 - t5) - t4
  42.         t3 = t3 & 0xffffffff
  43.         tmp = (t5 - t4) - t3 & 0xffffffff
  44.         idx = (t3 >> 0xf ^ tmp ) % 0x3f
  45.         out.append(charset[idx])
  46.     return ''.join(out)
  47.  
  48. limit = 30
  49. input = "Pack my box with five dozen liquor jugs. 1234567890"
  50. result = pseudopasswd(input, limit)
  51. print(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement