Add keyfile support. Not entirely working yet.

This commit is contained in:
Chris Oei 2012-09-03 10:41:14 -07:00
parent 5a3a8506fc
commit 3dd81551c6
3 changed files with 52 additions and 9 deletions

View file

@ -152,18 +152,18 @@ bintohex(char* outstring, size_t nbytes, uint8_t* data)
}
int
sha256string(uint8_t hash[32], char* s)
sha256string(uint8_t hash[32], uint8_t* s, int n)
{
SHA256_CTX sha256_ctx;
SHA256_Init(&sha256_ctx);
SHA256_Update(&sha256_ctx, (void*) s, strlen(s));
SHA256_Update(&sha256_ctx, (void*) s, n);
SHA256_Final(hash, &sha256_ctx);
}
static int
getsalt(uint8_t salt[32], void* site)
{
sha256string(salt, site);
sha256string(salt, site, strlen(site));
char buf[65];
bintohex(buf, 32, salt);
printf("Site hex: %s\n", buf);

View file

@ -73,7 +73,7 @@
*/
int bintohex(char* outstring, size_t nbytes, uint8_t* data);
int sha256string(uint8_t* hash, char* s);
int sha256string(uint8_t* hash, uint8_t* s, int n);
int genpass(uint8_t dk[64],
const uint8_t * passwd, size_t passwdlen, void* site,