字节和整数以及串联和 python
我有 2 个 32 位无符号整数..
777007543 和 114997259
和字节串..
0x47 0x30 0x22 0x2D 0x5A 0x3F 0x47 0x58
我如何让python给我这3个的串联,这样我就有...
0x2E 0x50 0x31 0xB7 0x06 0xDA 0xB8 0x0B 0x47 0x30 0x22 0x2D 0x5A 0x3F 0x47 0x58
然后我会通过md5哈希运行它并得到...
0x30 0x73 0x74 0x33 0x52 0x6C 0x26 0x71 0x2D 0x32 0x5A 0x55 0x5E 0x77 0x65 0x75
如果有人可以在python代码中运行它,我将不胜感激
I have 2 32bit unsigned integers..
777007543
and
114997259
and the string of bytes..
0x47 0x30 0x22 0x2D 0x5A 0x3F 0x47 0x58
How do I get python to give me the concatenation of these 3 such that I have...
0x2E 0x50 0x31 0xB7 0x06 0xDA 0xB8 0x0B 0x47 0x30 0x22 0x2D 0x5A 0x3F 0x47 0x58
I would then run that through an md5 hash and get...
0x30 0x73 0x74 0x33 0x52 0x6C 0x26 0x71 0x2D 0x32 0x5A 0x55 0x5E 0x77 0x65 0x75
If anyone could run that through in python code it would be much appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
就这样做。这就是它起作用的原因:
但是,如果您想要编辑,准确处理您在答案中显示的表示并不困难
:
这是斯科特·格里菲茨所说的。他是对的;)
just do this. here's why it works:
it's not difficult however to deal exactly with the representation you showed in your answer, if you want
edit:
here is what scott griffhits said. He's right ;)
这将为您提供所需的所有值的列表,
甚至更好(来自 您启动的其他线程),
如果您想将其作为字符串传递给您的 md5 散列,
我假设字符串的每个字节应该代表一个1字节的数字。
This will give you a list of all the values you want,
or even better (from the other thread you started),
If you then want to make this a string to pass to your md5 hash,
I am assuming that each byte of the string is supposed to represent a 1byte number.