Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <string.h>
- #include <openssl/md5.h>
- #include <glib.h>
- #include <termios.h>
- #include <stdlib.h>
- #include <unistd.h>
- int main(int argc, char * argv[])
- {
- printf("enter password: ");
- char * passwd = malloc(2048);
- struct termios term, term_orig;
- tcgetattr(STDIN_FILENO, &term);
- term_orig = term;
- term.c_lflag &= ~ECHO;
- tcsetattr(STDIN_FILENO, TCSANOW, &term);
- scanf("%s", passwd);
- unsigned char * hash = MD5((unsigned const char *)passwd, strlen(passwd), NULL);
- int i = strlen(hash);
- char * base64 = (char *)g_base64_encode((const guchar *)hash, (gsize)i);
- i = strlen(base64);
- while(i){
- base64[i]-=10;
- i--;
- }
- tcsetattr(STDIN_FILENO, TCSANOW, &term_orig);
- char * out = malloc(2048);
- i = strlen(base64) - 3;
- strncpy(out, (const char *)base64, i);
- printf("\n%s", out); printf("\n");
- }
- //gcc `pkg-config --cflags glib-2.0 libssl` passgen.c -o passgen `pkg-config --libs glib-2.0 libssl`
Advertisement
Add Comment
Please, Sign In to add comment