drdot
drdot

Reputation: 3347

How to concatenate two arbitrary long hex values?

I have two variables. Variable A contains 1024 bytes (not always ascii characters, arbitrary hex values) Variable B contains 64 bytes (not always ascii characters, arbitrary hex values)

How can I generate a variable C such that C = A || B ? (|| means concatenation)

Upvotes: 0

Views: 4344

Answers (2)

phihag
phihag

Reputation: 288260

The + operator works on bytes too:

>>> b'\x12\x14' + b'\x16\x0b'
b'\x12\x14\x16\x0b'

Upvotes: 4

Joran Beasley
Joran Beasley

Reputation: 114088

ummmm

A = '\x04\x05\x06'
B = '\x04\x05\x06'

C = A + B

Upvotes: 0

Related Questions