Skip to content

Instantly share code, notes, and snippets.

@eiyaya
Last active August 29, 2015 14:10
Show Gist options
  • Save eiyaya/33ba419bd49a1f768b3f to your computer and use it in GitHub Desktop.
Save eiyaya/33ba419bd49a1f768b3f to your computer and use it in GitHub Desktop.
apache md5 password hash generator
#include <stdio.h>
#include "apr-1/apr_md5.h"
int main(int argc, const char *argv[])
{
if (argc != 3)
{
printf("%s\n", "usage: apr_md5_generator password salt");
return -1;
}
const char* password = argv[1];
const char* salt = argv[2];
char hash[100];
char c=' ';
int i=0;
apr_md5_encode(password, salt, hash, sizeof hash);
while( c != '\0')
{
c=hash[i];
printf("%c", c);
i++;
}
printf("\n");
return 0;
}
@eiyaya
Copy link
Author

eiyaya commented Dec 7, 2014

usage:
yum install apr-util apr-util-devel
gcc apr_md5_generator.c -laprutil-1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment