Python random.init_from_bin() Examples
The following are 20
code examples of random.init_from_bin().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
random
, or try the search function
.
Example #1
Source File: auth_chain.py From shadowsocks with Apache License 2.0 | 6 votes |
def init_data_size(self, key): if self.data_size_list: self.data_size_list = [] self.data_size_list2 = [] random = xorshift128plus() random.init_from_bin(key) # 补全数组长为4~12-1 list_len = random.next() % 8 + 4 for i in range(0, list_len): self.data_size_list.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list.sort() # 补全数组长为8~24-1 list_len = random.next() % 16 + 8 for i in range(0, list_len): self.data_size_list2.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list2.sort()
Example #2
Source File: auth_chain.py From ssrr with Apache License 2.0 | 6 votes |
def init_data_size(self, key): if self.data_size_list: self.data_size_list = [] self.data_size_list2 = [] random = xorshift128plus() random.init_from_bin(key) # 补全数组长为4~12-1 list_len = random.next() % 8 + 4 for i in range(0, list_len): self.data_size_list.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list.sort() # 补全数组长为8~24-1 list_len = random.next() % 16 + 8 for i in range(0, list_len): self.data_size_list2.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list2.sort()
Example #3
Source File: auth_chain.py From SSRSpeed with GNU General Public License v3.0 | 5 votes |
def udp_rnd_data_len(self, last_hash, random): random.init_from_bin(last_hash) return random.next() % 127
Example #4
Source File: auth_chain.py From shadowsocksr-python with Apache License 2.0 | 5 votes |
def init_data_size(self, key): if self.data_size_list: self.data_size_list = [] self.data_size_list2 = [] random = xorshift128plus() random.init_from_bin(key) list_len = random.next() % 8 + 4 for i in range(0, list_len): self.data_size_list.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list.sort() list_len = random.next() % 16 + 8 for i in range(0, list_len): self.data_size_list2.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list2.sort()
Example #5
Source File: auth_chain.py From shadowsocksr-python with Apache License 2.0 | 5 votes |
def udp_rnd_data_len(self, last_hash, random): random.init_from_bin(last_hash) return random.next() % 127
Example #6
Source File: auth_chain.py From shadowsocksr-python with Apache License 2.0 | 5 votes |
def init_from_bin(self, bin): bin += b'\0' * 16 self.v0 = struct.unpack('<Q', bin[:8])[0] self.v1 = struct.unpack('<Q', bin[8:16])[0]
Example #7
Source File: auth_chain.py From ssrr with Apache License 2.0 | 5 votes |
def init_data_size(self, key): if self.data_size_list0: self.data_size_list0 = [] random = xorshift128plus() random.init_from_bin(key) # 补全数组长为12~24-1 list_len = random.next() % (8 + 16) + (4 + 8) for i in range(0, list_len): self.data_size_list0.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list0.sort() old_len = len(self.data_size_list0) self.check_and_patch_data_size(random) # if check_and_patch_data_size are work, re-sort again. if old_len != len(self.data_size_list0): self.data_size_list0.sort()
Example #8
Source File: auth_chain.py From ssrr with Apache License 2.0 | 5 votes |
def init_data_size(self, key): if self.data_size_list0: self.data_size_list0 = [] random = xorshift128plus() random.init_from_bin(key) # 补全数组长为12~24-1 list_len = random.next() % (8 + 16) + (4 + 8) for i in range(0, list_len): self.data_size_list0.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list0.sort()
Example #9
Source File: auth_chain.py From ssrr with Apache License 2.0 | 5 votes |
def udp_rnd_data_len(self, last_hash, random): random.init_from_bin(last_hash) return random.next() % 127
Example #10
Source File: auth_chain.py From ssrr with Apache License 2.0 | 5 votes |
def init_from_bin(self, bin): bin += b'\0' * 16 self.v0 = struct.unpack('<Q', bin[:8])[0] self.v1 = struct.unpack('<Q', bin[8:16])[0]
Example #11
Source File: auth_chain.py From SSRSpeed with GNU General Public License v3.0 | 5 votes |
def init_data_size(self, key): if self.data_size_list: self.data_size_list = [] self.data_size_list2 = [] random = xorshift128plus() random.init_from_bin(key) list_len = random.next() % 8 + 4 for i in range(0, list_len): self.data_size_list.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list.sort() list_len = random.next() % 16 + 8 for i in range(0, list_len): self.data_size_list2.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list2.sort()
Example #12
Source File: auth_chain.py From shadowsocksR-b with Apache License 2.0 | 5 votes |
def init_from_bin(self, bin): bin += b'\0' * 16 self.v0 = struct.unpack('<Q', bin[:8])[0] self.v1 = struct.unpack('<Q', bin[8:16])[0]
Example #13
Source File: auth_chain.py From SSRSpeed with GNU General Public License v3.0 | 5 votes |
def init_from_bin(self, bin): bin += b'\0' * 16 self.v0 = struct.unpack('<Q', bin[:8])[0] self.v1 = struct.unpack('<Q', bin[8:16])[0]
Example #14
Source File: auth_chain.py From Dockerfiles with Apache License 2.0 | 5 votes |
def udp_rnd_data_len(self, last_hash, random): random.init_from_bin(last_hash) return random.next() % 127
Example #15
Source File: auth_chain.py From Dockerfiles with Apache License 2.0 | 5 votes |
def init_from_bin(self, bin): bin += b'\0' * 16 self.v0 = struct.unpack('<Q', bin[:8])[0] self.v1 = struct.unpack('<Q', bin[8:16])[0]
Example #16
Source File: auth_chain.py From shadowsocks with Apache License 2.0 | 5 votes |
def init_data_size(self, key): if self.data_size_list0: self.data_size_list0 = [] random = xorshift128plus() random.init_from_bin(key) # 补全数组长为12~24-1 list_len = random.next() % (8 + 16) + (4 + 8) for i in range(0, list_len): self.data_size_list0.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list0.sort() old_len = len(self.data_size_list0) self.check_and_patch_data_size(random) # if check_and_patch_data_size are work, re-sort again. if old_len != len(self.data_size_list0): self.data_size_list0.sort()
Example #17
Source File: auth_chain.py From shadowsocks with Apache License 2.0 | 5 votes |
def init_data_size(self, key): if self.data_size_list0: self.data_size_list0 = [] random = xorshift128plus() random.init_from_bin(key) # 补全数组长为12~24-1 list_len = random.next() % (8 + 16) + (4 + 8) for i in range(0, list_len): self.data_size_list0.append((int)(random.next() % 2340 % 2040 % 1440)) self.data_size_list0.sort()
Example #18
Source File: auth_chain.py From shadowsocks with Apache License 2.0 | 5 votes |
def udp_rnd_data_len(self, last_hash, random): random.init_from_bin(last_hash) return random.next() % 127
Example #19
Source File: auth_chain.py From shadowsocks with Apache License 2.0 | 5 votes |
def init_from_bin(self, bin): if len(bin) < 16: bin += b'\0' * 16 self.v0 = struct.unpack('<Q', bin[:8])[0] self.v1 = struct.unpack('<Q', bin[8:16])[0]
Example #20
Source File: auth_chain.py From shadowsocksR-b with Apache License 2.0 | 5 votes |
def udp_rnd_data_len(self, last_hash, random): random.init_from_bin(last_hash) return random.next() % 127