本文整理汇总了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