Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <openssl/md5.h>
- #include <glib.h>
- #include <stdlib.h>
- int main(int argc, char * argv[])
- {
- if(argc<2){
- printf("usage: passgen [password]\n");
- exit(0);
- }
- char * buffer = malloc(255);
- strncpy(buffer, (const char *)argv[1], 255);
- unsigned char * hash = MD5((unsigned const char *)argv[1], strlen(argv[1]), 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--;
- }
- printf("%s", base64); 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