I wanted to demonstrate that passwords in clear are easy to read from a program:
#include <stdio.h>
#include <string.h>
int main(int argc, char** argv)
{
char password[] = "a big refreshing lemonade";
return strcmp(argv[1], password);
}
But it does not work as expected:
$ gcc foo.c
$ hexdump -C a.out | grep -C2 'lem'
000006c0 00 00 00 48 89 45 f8 31 c0 48 b8 61 20 62 69 67 |...H.E.1.H.a big|
000006d0 20 72 65 48 ba 66 72 65 73 68 69 6e 67 48 89 45 | reH.freshingH.E|
000006e0 d0 48 89 55 d8 48 b8 20 6c 65 6d 6f 6e 61 64 48 |.H.U.H. lemonadH|
000006f0 89 45 e0 66 c7 45 e8 65 00 48 8b 45 c0 48 83 c0 |.E.f.E.e.H.E.H..|
00000700 08 48 8b 00 48 8d 55 d0 48 89 d6 48 89 c7 e8 6d |.H..H.U.H..H...m|
I notice some weird characters. Why is that?