password-scheme.c revision 6c07b8ddc5e894feead4d422075b079451721241
/* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "hex-binary.h"
#include "md5.h"
#include "mycrypt.h"
#include "randgen.h"
#include "password-scheme.h"
static const char *salt_chars =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
{
unsigned char digest[16];
return 0;
}
}
/* user:realm:passwd */
}
}
return -1;
}
const char *password_get_scheme(const char **password)
{
const char *p, *scheme;
return NULL;
/* skip the salt */
if (p != NULL) {
/* stop at next '$' */
if (p != NULL)
return "MD5";
}
}
if (**password != '{')
return NULL;
if (p == NULL)
return NULL;
*password = p + 1;
return scheme;
}
const char *scheme)
{
unsigned char digest[16];
char salt[9];
int i;
}
for (i = 0; i < 8; i++)
}
return plaintext;
return password_generate_cram_md5(plaintext);
/* user:realm:passwd */
}
}
return NULL;
}