Live data from Hacker News

C code that can be “compiled” by sha384

weijr-eng.blogspot.com

1–3 of 3 posts

Re: C code that can be “compiled” by sha384

#2
"sha384 was chosen because it is possible to fit an ELF binary into sha384 digest"

Except none of the sources have a sha384 that ends up being an ELF binary.

In the first example, the important thing is that the sha384 digest starts with 0a23, so "\n#" so that this essentially "compiles" to an empty shell script.

In the second example, the digest starts with 2e202a0a, which is ". * \n", so it only really works because the source, 0.c, is the first file in the directory, and is both a sourceable shell script and a C source file. Remove it, and the trick doesn't work anymore.

In the final one, the trick is similar, but the digest starts with "sh * \n" instead.

EDIT: asterisks are inconveniently turned into italic formatting. Consider all asterisks in this post as not followed by a whitespace.

Re: C code that can be “compiled” by sha384

#3
post #2

"sha384 was chosen because it is possible to fit an ELF binary into sha384 digest" Except none of the sources have a sha384 that ends up being an ELF binary. In the first example, the important thing is that the sha384 digest starts with 0a23, so "\n#" so that this essentially "compiles" to an empty shell script. In the second example, the digest starts with 2e202a0a, which is ". * \n", so it only really works becaus…

Thank you, I was wondering how this could possibly work.