Created
March 5, 2014 18:30
-
-
Save xzfc/9373497 to your computer and use it in GitHub Desktop.
Tiny terminal sigil in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// gcc -std=c99 -lcrypto sigil.c -o sigil | |
#include <openssl/md5.h> | |
#include <string.h> | |
#include <stdio.h> | |
#include <arpa/inet.h> | |
int main(int argc, char **argv) | |
{ | |
char *s = (argc>1)?argv[1]:""; | |
unsigned char md5[16]; | |
MD5(s, strlen(s), md5); | |
int fg = (int[]){27, 214, 176, 39, 167, 77, 97}[md5[0]%7]; | |
uint32_t pic = ntohl(*(uint32_t*)(md5+1)); | |
printf(" \e[38;5;254m▄▄▄▄▄▄▄▄▄▄▄▄\e[m \n"); | |
for(int y = 0; y < 5; y++) | |
{ | |
printf(" \e[48;5;254;38;5;%dm ", fg); | |
#define B(x) printf(1&pic>>31-5*x-y?"██":" "); | |
B(0)B(1)B(2)B(1)B(0) | |
printf(" \e[m \n"); | |
} | |
printf(" \e[38;5;254m▀▀▀▀▀▀▀▀▀▀▀▀\e[m \n"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment