2024-10-03 02:47:51 发布
网友
我正在编写一个填充oracle攻击的程序,需要bytearrays, 但是如果我定义一个新的bytearray,那么第一个字节0x63的打印方式就不同了
bytearrays
bytearray
0x63
我必须按字节XOR2bytearrays
XOR
test = bytearray( [99,203,00] ) print(test) print(hex(99))
输出:
bytearray(b'c\xcb\x00') 0x63
这是我的第一个问题。谢谢你的帮助
对于字符串输出,python将可打印的十六进制代码替换为chr(hexcode)字符,以便显示:
chr(hexcode)
print('c', ord('c'),hex(ord('c'))) # c 99 '0x63' t = bytearray([99,203,0]) print(t) # bytearray(b'c\xcb\x00') print(t[0],t[1],t[2]) # 99 203 0
它们是等价的,但打印出来的时间更短。您可以得到一个全十六进制表示,如下所示:
t = bytearray([99,203,0]) t_hex = '\\'+'\\'.join( ( hex(i) for i in t) ) print(t_hex)
\0x63\0xcb\0x0
对于字符串输出,python将可打印的十六进制代码替换为
chr(hexcode)
字符,以便显示:它们是等价的,但打印出来的时间更短。您可以得到一个全十六进制表示,如下所示:
输出:
相关问题 更多 >
编程相关推荐