The SSH host key has changed on 8 April, 2022 to this one: SHA256:573uTBSeh74kvOo0HJXi5ijdzRm8me27suzNEDlGyrQ
A small C program that dumps any file’s contents as binary
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

/*
* This file was originally written by Gergely Polonkai, and is
* licensed inder the DBAD:
*
* Do whatever you like with the original work, just don't be a dick.
*
* Being a dick includes - but is not limited to - the following
* instances:
* 1a. Outright copyright infringement - Don't just copy this and
* change the name.
* 1b. Selling the unmodified original with no work done
* what-so-ever, that's REALLY being a dick.
* 1c. Modifying the original work to contain hidden harmful
* content. That would make you a PROPER dick.
*
* If you become rich through modifications, related works/services,
* or supporting the original work, share the love. Only a dick would
* make loads off this work and not buy the original work's creator(s)
* a pint.
*
* Code is provided with no warranty. Using somebody else's code and
* bitching when it goes wrong makes you a DONKEY dick. Fix the
* problem yourself. A non-dick would submit the fix back.
*/
#include <stdio.h>
int
main(int argc, char **argv)
{
FILE *file;
int c;
if ((file = fopen(argv[1], "r")) == NULL) {
fprintf(stderr, "Unable to open file!\n");
return 1;
}
while ((c = fgetc(file)) != EOF) {
int i;
// For each byte in a file, print the byte as a binary string
// (a bunch of '0' and '1' characters
for (i = 7; i>= 0; i--) {
printf(((c & (2 ^i)) != 0) ? "0" : "1");
}
}
return 0;
}