Many years ago I used to have a 58-byte version, but around the time that x86-64 was being developed, Linux started examining (and thus validating) a couple more fields in the ELF header. It's really a shame, because the corner-cutting in the 62-byte version isn't nearly as impressive (in my own opinion).
It makes more sense for VM byte-code as the bytes not only have to be loaded (probably by the page, again) but the bytes have to be run and possibly jitted, too.
I edited out the words "apart from on an embedded device with a tiny memory" as I had hoped that the mention of the modern computer and virtual memory would suffice.
But this was a genuine question rather than a put-down. I was hoping to have my assumption debunked.
EDIT: I have no idea why you're being down-voted seems unfair
but that's not the main reason it's often used in shellcode. The xor reg, reg is preferred because it means the resulting shellcode will not contain a null byte. This is desirable since the null-byte is often used as a string terminator, in environment variables for example.
Because it doesn't make any sense? What, are you planning just randomly try every permutation of 142 bytes?
You can't have a genetic algorithm run on something where almost every attempt will simply produce invalid code. Genetic algorithms work when you can try various strategies to maximize a fitness function. But here the fitness is yes or no, does it work or not. There is nothing to maximize - and you can't try to maximize the "size fitness" because pretty much all the attempts will produce invalid code, so there is nothing to mix together for various generations.
I disagree completely. The fitness function is clear, and that fact that many children will produce invalid code is not that much of a problem, really. You just eliminate them.
Google "automatic programming" if you think it's never been done, your mind is about to be expanded.
You should really learn to think for a while before you dismiss ideas as "nonsensical".
I believe you entirely missed the point. This was more of an "Look at how you can abuse the loader and play with ELF headers" and in general show an interesting 'hacky' article, not "this is smaller, thus more efficient" argument.
I figured this was posted as a related article to the Dash "Hello World" issue where people are pointing at 17,000 lines of Hello World code, because it includes the runtime when compiled to Javascript.
There was another comment about how this will be the next "Fibonacci debacle", related to how Ted Dzubia trolled the node.js crowd by pointing out it's weakness for CPU-intensive tasks, then had a ton of people wasting time on writing faster Fibonacci algorithms in node just to prove him wrong.
My point was that comparing languages by the size of their Hello World programs is a useless exercise.
Your implementation is not x86 ELF. Regardless, I don't recall the author's insistence that finding the smallest executable was desirable. "Stupid metrics" make for great educational exercises.
http://www.muppetlabs.com/~breadbox/software/tiny/
(62-byte hello world among other things)