hexer
/* hexer - Convert binary files to hexadecimal Copyright 2007 Hal Canary Dedicated to the Public Domain. */ /* cc -o hexer hexer.c */ #include <stdio.h> #include <stdlib.h> int main (int argc, char *argv[]) { int i=0; char x; while (fread(&x, sizeof(x), 1, stdin) == 1) { i++; printf("%02hhx",x); if (i % 32 == 0) { printf("\n"); } } printf("\n"); return(0); } /*EOF*/
Or:
#!/bin/sh exec hexdump -e '32/1 "%02x" "\n"' "$@"