Skip to main content
Stack Overflow
  1. About
  2. For Teams
Filter by
Sorted by
Tagged with
0 votes
1 answer
100 views

I'm trying to convert a hexadecimal number, like the stack address 0x7ffd6fa90940, into its corresponding Byte representation b'\x40\x09\xa9\x6f\xfd\x7f\x00\x00'. Just like how it is represented in ...
0 votes
2 answers
129 views

I've seen a lot of posts about this subject but I haven't found the solution I'm looking for (despite lot of attempts ...). In a nutshell, when migrating one of my libraries from Python2 to 3, whose ...
0 votes
1 answer
200 views

i am trying to convert a hex string to bin using binascii.a2b_hex but i get binascii.Error: Odd-length string only with some strings, not everytime. for example this is the string throwing the error: ...
0 votes
3 answers
322 views

Hello when I use binascii.a2b_hex, error is occured. There is no error message but the return value is wrong. Here is the data and the resule. Input : FEB10AA86764FFFF Output : b'\xfe\xb1\n\xa8gd\xff\...
0 votes
1 answer
249 views

I am trying to convert a mac address in hex like this: 00453645f200 to a Mac address in bytes like this: x00\x45\x36\x45\xf2\x00 But if I use binascii.unhexlify, the result is like this: b'\x00E6E\xf2\...
0 votes
2 answers
115 views

I'm using the following code to pack an integer into an unsigned short as follows, raw_data = 40 # Pack into little endian data_packed = struct.pack('<H', raw_data) Now I'm trying to unpack the ...
1 vote
1 answer
604 views

I have data in form of hexadecimal string and I convert it to float as: import struct, binascii a = '0X437A1AF6' x = struct.unpack('>f', binascii.unhexlify(str(a)[2:])) print(x[0]) I get the right ...
0 votes
0 answers
1k views

I am processing the email files from Amazon SES. The email contains a pdf file encoded with base64. Content-Type: application/octet-stream; name="IN081AKC.pdf" Content-Transfer-Encoding: ...
1 vote
1 answer
528 views

import binascii import sys from os.path import getsize target = './'+sys.argv[1] with open(target,'rb+') as f: file_size = getsize(target) string1 = f.read(6) print("Size : %d&...
3 votes
1 answer
1k views

I am trying to write an hex string into a file using python 2.7 so that when opened with HxD I can retrieve the same hex values. The following code works fine on multiple input strings, but when the ...
0 votes
0 answers
35 views

I have a simple piece of Python code where I want to xor two hex strings and unhexlify the result as below def _xor(s1, s2): return hex(int(s1, 16) ^ int(s2, 16))[2:] if __name__ == "...
2 votes
1 answer
554 views

Good morning people! I've been trying to convert this code written in Python 2 to Python 3.It's a simple function to encrypt strings using XOR. What I have so far: import binascii def encrypt(content:...
1 vote
1 answer
1k views

given the following Python code: bits = [0]*256 # for simplicity (actually it's more like (0|1)^n) binstr = "" # make string containing all 'bits' for el in bits: binstr += str(el) ...
1 vote
1 answer
902 views

I am in the process of bringing an API up from 2.7 to 3.8. It is built to communicate with an agent over a TCP socket. I am having an issue with a checksum not being calculated right. I get a message ...
mattmccj's user avatar
-1 votes
1 answer
576 views

Hi there i'm quite new with xBee and struggle with data transferring. My objective is to take picture with Raspberry pi wide and send it back to computer via xBee by turn that image to hexlify code. ...

15 30 50 per page
1
2 3 4

AltStyle によって変換されたページ (->オリジナル) /