Advertisement
DigitalMag

Triple keys generation

Jul 10th, 2020
1,224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.85 KB | None | 0 0
  1. import random
  2.  
  3. def i3_statement(lvls):
  4.  
  5.     lvls = [random.randint(0, 199) for i in range(3)]
  6.     istatement = lambda x: (65**x) % 839
  7.     o_keys = tuple(istatement(lvl) for lvl in lvls)
  8.     rez = ''.join([str(lv).rjust(3,'0') for lv in o_keys])
  9.     return rez, lvls
  10.  
  11. def i3post_statement(o_kyes, skeys):
  12.  
  13.     ipost_statement = lambda ml, lv: (ml**lv) % 839
  14.     o_kyes = [int(o_kyes[i:i + 3]) for i in range(0, len(o_kyes), 3)]
  15.     keys = [ipost_statement(o_kyes[i],skey) for i, skey in enumerate(skeys)]
  16.     rez = ''.join([str(k).rjust(3,'0') for k in keys])
  17.     return rez
  18.  
  19. def main():
  20.  
  21.     oc_keys, sc_keys = i3_statement(sc_keys)
  22.     os_keys, ss_keys = i3_statement(ss_keys)
  23.  
  24.     s_value = i3post_statement(oc_keys, ss_keys)
  25.     c_value = i3post_statement(os_keys, sc_keys)
  26.  
  27.     print s_value, c_value
  28.  
  29.  
  30. if __name__ == '__main__':
  31.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement