d415k's CTF memos.

雑な技術メモ

11 August 2022

Python3

$ python3 --version
Python 3.10.5

Bytes -> HEX String

b = b'abc\n'
s = b.hex()
print(f'{b=}, {s=}')
b=b'abc\n', s='6162630a'

HEX String -> Bytes

s = '782079207a0a'
b = bytes.fromhex(s)
print(f'{s=}, {b=}')
s='782079207a0a', b=b'x y z\n'
tags: CTF - Common - cheatsheet - Python3