Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
thank you for the upvote
there are no spoiler flag in comments of forks, so if you have something to tell involving the solutions, you should put that in the description of the fork, not here.
This comment is hidden because it contains spoiler information about the solution
I also was not able to find a solution shorter than 10 bytes.
long double
has 10 bytes which can be used for opcodes (it occupies 16 bytes in memory but 6 bytes are always 0).it's the other way around. you start from the x64 assembly instructions you want to encode, then to their opcodes, then you concatenate these opcodes into bytes.
let's see the bytes that make up the constant:
output:
Let's disassemble those bytes (you can do it with an online tool, like this one):
(the extra bytes is filler that will not be reached, since control will leave at the
ret
instruction)this assembly payload occupies
9
bytes of memory. this is too many for 64-bit = 8 bytes integers /double
, this is why along double
was used (on Linux,long double
s occupy 16 bytes of memory). With this method, you can encode any payload - to see the constant that correspond to those bytes, you just have to reverse the process I showed in my first snippet: put the opcodes in anunsigned char[]
array,memcpy()
the bytes to your constant (which could be anint
orlong long
if you need less bytes), and print it:output: