This category tests your skills in fundamental areas for understanding modern cryptography. These include data encoding, the XOR operator, and basic modular arithmetic. You may know this stuff already, but you can still gain points and have fun completing these challenges!
It may be possible to solve these challenges using online converters and tools, however it will pay off later if you solve them in a programming language and learn how to do it that way instead. Of these, we suggest Python 3 (see the FAQ).
chr()
function can be used to convert an ASCII ordinal number to a character (the ord()
function does the opposite).
You must be logged in to submit your flag.
bytes.fromhex()
function can be used to convert hex to bytes. The .hex()
instance method can be called on byte strings to get the hex representation.You must be logged in to submit your flag.
import base64
, you can use the base64.b64encode()
function. Remember to decode the hex first as the challenge description states.
You must be logged in to submit your flag.
bytes_to_long()
and long_to_bytes()
. You will first have to install PyCryptodome and import it with from Crypto.Util.number import *
. For more details check the FAQ.You must be logged in to submit your flag.
13377.py
file attached below is the source code for what's running on the server. The pwntools_example.py
file provides the start of a solution.utils.listener
module.socket.cryptohack.org 13377
You must be logged in to submit your flag.
^
used instead. A | B | Output |
---|---|---|
0 | 0 | 0 |
0 | 1 | 1 |
1 | 0 | 1 |
1 | 1 | 0 |
For longer binary numbers we XOR bit by bit: 0110 ^ 1010 = 1100
. We can XOR integers by first converting the integer from decimal to binary. We can XOR strings by first converting each character to the integer representing the Unicode character.
Given the string label
, XOR each character with the integer 13
. Convert these integers back to a string and submit the flag as crypto{new_string}
.
The Python pwntools
library has a convenient xor()
function that can XOR together data of different types and lengths. But first, you may want to implement your own function to solve this.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
You must be logged in to submit your flag.
from Crypto.PublicKey import RSA
and you can read the key data using RSA.importKey()
.You must be logged in to submit your flag.
You must be logged in to submit your flag.
socket.cryptohack.org
- data is sent to a remote server, which performs actions based on what is sent. There is no transport encryption, so anyone listening in on the network (such as the WiFi access point owner, your ISP, or the NSA) can see all the telnet traffic.bschneier
to his server bruces-server
. From his laptop he runs ssh bschneier@bruces-server
. His SSH client opens a connection to the server on port 22 where the SSH daemon listens. First, the ciphers that will be used are agreed upon, then a session key to encrypt the connection is established using Diffie-Hellman Key exchange, but we won't go into the details on that here. Then, the server sends a random challenge message encrypted with Bruce's public key. Bruce uses his private key to decrypt the challenge and send a hash of the random challenge message back, proving that he owns the correct private key and he therefore authenticates himself to the server as bschneier
. Now, the server gives Bruce a shell to run commands. If public-private key cryptography doesn't make sense to you yet, don't worry - we'll cover it extensively in the RSA category./home/bschneier/.ssh/id_rsa
:/home/bschneier/.ssh/authorized_keys
on the server. Adding the public key to this file allows the corresponding private key to be used to authenticate on the server.ssh-keygen
command is used to produce these public-private keypairs.You must be logged in to submit your flag.
You must be logged in to submit your flag.
You are now level Current level