本文整理匯總了Python中z3.LShR方法的典型用法代碼示例。如果您正苦於以下問題:Python z3.LShR方法的具體用法?Python z3.LShR怎麽用?Python z3.LShR使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類z3
的用法示例。
在下文中一共展示了z3.LShR方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: chicken_hash_xor
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def chicken_hash_xor(bytes, m, r):
key = z3.BitVecVal(r, 64)
for byte in bytes:
key ^= ((key << 6) + (z3.LShR(key, 2)) + z3.ZeroExt(56, byte))
return key
示例2: z3crc32
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def z3crc32(bytes, hash_table_size): # computes the crc32 checksum in z3 format
checksum = 0x00000000ffffffff
for byte in bytes:
checksum ^= z3.ZeroExt(56, byte) & 0xff
for _ in range(8): # test each bit in the byte we just xor'd in
checksum = z3.If(checksum & 1 == z3.BitVecVal(1, 64),
z3.LShR(checksum, 1) ^ 0xedb88320, # the binary representation of the CRC-32 polynomial
z3.LShR(checksum, 1))
return (checksum ^ 0xffffffff) % hash_table_size
示例3: hash2
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def hash2(name):
h = z3.BitVecVal(0, 16)
assert len(name) % 2 == 0 # for simplicity
for i in range(0, len(name), 2):
a = z3.BitVecVal(0, 16)
a |= z3.Extract(15, 0, name[i])
a |= z3.Extract(15, 0, name[i + 1]) << 8
h ^= a
a = z3.LShR(h, 10)
b = z3.ZeroExt(8, z3.Extract(7, 0, h ^ z3.LShR(h, 5)))
h = (a ^ b) & 0x1f
return h
示例4: hash3
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def hash3(name):
h = z3.BitVecVal(0, 32)
for i in range(len(name)):
for j in range(8):
h = z3.If(z3.LShR(name[i], j) & 1 == 1, (h + 1) & 0xff, h)
h &= 0x1f
return h
示例5: f_b
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def f_b(a1, a2, a3):
return (to8(z3.LShR(a1, 8 * a2)) << 8 * a3) | (
to8(z3.LShR(a1, 8 * a3)) << 8 * a2) | ~(255 << 8 * a2) & ~(255 << 8 * a3) & a1
示例6: f_c
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def f_c(a1, a2):
return (a1 << (a2 & 0x3F)) | (z3.LShR(a1, (64 - (a2 & 0x3F))))
示例7: f_d
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def f_d(a1, a2):
return (a1 << (64 - (a2 & 0x3F))) | z3.LShR(a1, (a2 & 0x3F))
示例8: f_f
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def f_f(a1):
return z3.LShR((a1 & 0xFF00000000000000), 8) | z3.LShR((a1 & 0xFF000000000000), 40) | z3.LShR(
(a1 & 0xFF0000000000), 40) | z3.LShR((a1 & 0xFF00000000), 16) | ((to32(a1) & 0xFF000000) << 16) | (
(a1 & 0xFF0000) << 40) | ((to16(a1) & 0xFF00) << 24) | (to16(a1) << 24)
示例9: crc32
# 需要導入模塊: import z3 [as 別名]
# 或者: from z3 import LShR [as 別名]
def crc32(data,size,prev=0):
crc = prev ^ 0xFFFFFFFF
for i in range(0,size,8):
crc = crc ^ (z3.LShR(data,i) & 0xFF)
for _ in range(8):
crc = If(crc & 1 == BitVecVal(1, size), z3.LShR(crc,1) ^ polynomial, z3.LShR(crc,1))
return crc ^ 0xFFFFFFFF