WARGAME/cryptography

[CryptoHack] Bytes and Big Integers

lucykorea414 2024. 1. 2. 19:19
728x90

Converting messages into numbers in order to apply mathematical operations:

1. take the ordinal bytes of the message

2. convert them into hexadecimal

3. concatenate

-> this is interpreted as a base-16/hexadecimal number (also can be represented in base-10/decimal)

 

 

ex)

message: HELLO
ascii bytes: [72, 69, 76, 76, 79]
hex bytes: [0x48, 0x45, 0x4c, 0x4c, 0x4f]
base-16: 0x48454c4c4f
base-10: 310400273487

 

 

quiz)

Convert the following integer back into a message:

11515195063862318899931685488813747395775516287289682636499965282714637259206269

 

풀이

⭐️ PyCryptodome 라이브러리의 long_to_bytes() / bytes_to_long() 메서드를 사용하여 구할 수 있음!!

 

결과:

 

728x90

'WARGAME > cryptography' 카테고리의 다른 글

[CryptoHack] XOR Properties  (2) 2024.01.02
[CryptoHack] XOR Starter  (1) 2024.01.02
[dreamhack] SingleByteXor  (1) 2023.11.08
[dreamhack] ICM2022  (0) 2023.11.08
[dreamhack] Basic_Crypto1  (0) 2023.11.08