33 lines
868 B
Markdown
33 lines
868 B
Markdown
# XMASSpirit
|
|
|
|
Now that elves have taken over Santa has lost so many letters from kids all
|
|
over the world. However, there is one kid who managed to locate Santa and sent
|
|
him a letter. It seems like the XMAS spirit is so strong within this kid. He
|
|
was so smart that thought of encrypting the letter in case elves captured it.
|
|
Unfortunately, Santa has no idea about cryptography. Can you help him read the
|
|
letter?
|
|
|
|
## Flag
|
|
|
|
HTB{4ff1n3_c1ph3r_15_51mpl3_m47h5}
|
|
|
|
- See letter.pdf
|
|
|
|
## How to solve
|
|
|
|
See `decrypt.py`
|
|
|
|
## Progress
|
|
|
|
### Code analysis:
|
|
- Choose a `randint` `a` from `1` to `mod`, that is not divisible by mod.
|
|
- Choose a `randint` `b` from `1` to `mod`.
|
|
- for each byte in `dt`
|
|
- calculate `(a * byte + b) % mod`
|
|
- append to output bytes
|
|
- return bytes when done
|
|
|
|
### Notes
|
|
|
|
- `s_next = (a * s_prev + b) mod p` is a linear congruential generator
|