0
比方說,我有這些方法獲取原始內容,編碼不吉利的東西和位向量
def convert_to_bv(a):
if type(a) is str:
return BitVector.BitVector(textstring=a)
if type(a) is int:
return BitVector.BitVector(intVal = a)
def convert_to_hex(b):
return BitVector.BitVector.get_bitvector_in_hex(b)
現在我也正在使用codecs.encode /解碼。
測試用例:
a = '12324'
print(a)
b = codecs.encode(a, 'hex')
print(b)
c= codecs.decode(b, 'hex')
print(c)
x = BitVector.BitVector(textstring=a)
y = convert_to_bv(a)
print(str(x)==str(y)) #this comes out as true
m = convert_to_hex(x)
n = convert_to_hex(y)
print(m, n)
o = convert_to_bv(codecs.decode(m, 'hex'))
print(str(o), str(y)) #true
的問題是,我似乎並沒有能夠要回的價值。