Advertisement
Zeda

ctf

Oct 1st, 2019
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. def next():
  2.     ret = 0
  3.     for i in range(26):
  4.         ret <<= 1                                                                       # Rotate left, add the lowest bit from the state
  5.         ret |= state & 1
  6.         state = (state << 1) ^ (state >> 61)                                            # Rotate left, move upper bit to lowest bit
  7.         state &= 0xFFFFFFFFFFFFFFFF                                                     #
  8.         cur0 = state & 0x8888888888888888
  9.         cur1 = state & 0x1111111111111111
  10.         state = state ^ (cur0 >> 2) ^ (cur0 >> 3) ^ (cur1 << 2) ^ (cur1 << 3)
  11.  
  12.     return ret
  13.  
  14.  
  15. # next() = 20016517 = 0b01001100010110110110000101
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement