← Back to Writeups
CUSTOMEasyCrypto

Подозреваемый (Suspect)

XESXOR9/10/20262 min read
#crypto#custom#easy#integer-to-bytes-conversion#big-endian-byte-order-decoding#hex-string-to-bytes-conversion

Подозреваемый (Suspect)

Platform: hackerlab | Category: Crypto | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2025-12-30 | Status: Solved Techniques: Integer to bytes conversion, Big-endian byte order decoding, Hex string to bytes conversion

Summary

Translation: "The suspect was silent for a long time, then suddenly said a number... We've never encountered this before. Help us understand what he's trying to tell us."

Подозреваемый (Suspect) — hackerlab

Description

"Подозреваемый долго молчал, а потом внезапно назвал число... Мы никогда с таким не встречались. Помоги понять нам, что он пытается до нас донести."

Translation: "The suspect was silent for a long time, then suddenly said a number... We've never encountered this before. Help us understand what he's trying to tell us."

Analysis

The file sus.txt contains one large number:

6446982264000635652948556502623658209996049063529575549

Key observations:

  1. Number is too small for RSA — doesn't look like a cryptographic modulus
  2. Description mentions "number as message" — the suspect "said a number"
  3. File name "sus" — suspicious ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Hypothesis: Text is encoded as a large integer (text-to-int encoding). Each ASCII character is represented as a byte, and the entire byte sequence is interpreted as one large number.

Solution

Method 1: int.to_bytes()

python
#!/usr/bin/env python3

n = 6446982264000635652948556502623658209996049063529575549

# Calculate required number of bytes
byte_length = (n.bit_length() + 7) // 8

# Convert number to bytes (big-endian)
result = n.to_bytes(byte_length, 'big')

print(result)
# b'CODEBY{REDACTED}'

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Method 2: Via hex string

python
#!/usr/bin/env python3

n = 6446982264000635652948556502623658209996049063529575549

# Convert to hex, remove '0x' prefix
hex_str = hex(n)[2:]

# If odd number of characters, add leading zero
if len(hex_str) % 2:
    hex_str = '0' + hex_str

# Convert hex to bytes, then to string
result = bytes.fromhex(hex_str).decode('utf-8')

print(result)
# 'CODEBY{REDACTED}'

Verification of reverse conversion

python
# How text is encoded into a number:
text = "CODEBY{REDACTED}"
encoded = int.from_bytes(text.encode(), 'big')
print(encoded)
# 6446982264000635652948556502623658209996049063529575549

‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍

Mathematics

Text-to-int encoding works as follows:

  • String "ABC" = bytes [0x41, 0x42, 0x43]
  • Big-endian interpretation: 0x41 * 256² + 0x42 * 256 + 0x43 = 4276803

Reverse conversion:

  • Number is divided by 256, remainders give bytes from right to left
  • Or use int.to_bytes() in Python

Alternative Names for This Technique

  • Text-to-int encoding — encoding text as a number
  • Integer message encoding — integer encoding of a message
  • Big integer text representation — representing text as a large number
  • Bytes-to-int conversion — converting bytes to an integer ‍​‌‌​​‌​​​‌‌​​‌​​​​‌‌​‌​​​​‌‌‌​​‌​​‌‌​​​‌​​‌‌‌​​​​​‌‌​‌‌​​​‌‌​​​​‍