On my linux shell (ubuntu) if I type the following command:
echo -n -e "THIS IS A TEST" | md5sum
I get the md5 hash value of: 1586CFFAFA39E38959477DA9EAA41C31
If I do the following:
awk -f short.awk
where short.awk contains:
BEGIN {
print "HELLO"
md5sum_command = sprintf("echo -n -e \"%s\" | md5sum", "THIS IS A TEST");
if ( (md5sum_command | getline line) > 0) {
result = line;
type = "linux";
hash_command = "echo -n -e \"%s\" | md5sum";
printf("Command: %s\nResult = %s\n", md5sum_command, result);
printf("It looks like you are on a linux environment, so the md5sum command will be used\n");
} else {
result = "FAILED";
}
close(md5sum_command);
}
I get an md5 hash value of: a842e5b39bf5aef1af5d4a0ef7acf8e9
I cannot figure out what the issue is.