The challenge is to receive bytes and extract some numbers from those bytes.
Connect to the problem endpoint, grab a
base64-encoded pack of bytes, unpack the required values from it and send them back.
The pack contains, always in the following order:
int(signed), to start off
short(signed) to make things interesting
floatbecause floating point is important
doublebut this time in big endian (network byte order)
In case you're wondering, we're using 4 byte
ints, so everything is in the context of a 32-bit platform.
Extract those numbers from the byte string and send them back to the solution endpoint for your reward. See the solution section for a description of the expected JSON format.
Problem JSON format will be in the following format:
bytes: base64 encoded bytes that you have to unpack
Solution JSON structure:
int: the signed integer value
uint: the unsigned integer value
short: the decoded
float: surprisingly, the float value
double: the double value - shockingly
big_endian_double: you get the idea by now!
To make things easier, the response will usually include info about which value you got wrong and what was the expected value.
This challenge is actually inspired in part by the Redis one challenge, where reading things from raw bytes is sort of necessary. I also figured
h^ really needed a simple, first-timer friendly challenge with a simple premise, and here it is!
By the way, I was always slightly fascinated by how floating point things are stored. The IEEE754 format is actually really, really neat - it's just that people in general suck at explaning it (jumping straight to math, which is lazy). If you want to read more into it, I can wholeheartedly recommend floating point visually explained. It's a great piece.
h^by buying me a coffee. Cheers!
h^profile is here.