Add simple algorithm for converting result hash to password
This commit is contained in:
parent
b3d2d92c81
commit
395b11b807
6 changed files with 80 additions and 3 deletions
18
lib/util/hashtopass.c
Normal file
18
lib/util/hashtopass.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "hashtopass.h"
|
||||
|
||||
void hashtopass(char* p, size_t len, uint8_t* key)
|
||||
{
|
||||
char* lowers = "abcdefghijklmnopqrstuvwxyz";
|
||||
char* uppers = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
||||
char* numerals = "0123456789";
|
||||
char* allchars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
|
||||
p[0] = lowers[key[0] % 26];
|
||||
p[1] = numerals[key[1] % 10];
|
||||
p[2] = uppers[key[2] % 26];
|
||||
|
||||
size_t i;
|
||||
for (i = 3; i < len; i++)
|
||||
p[i] = allchars[key[i] % (26 + 26 + 10)];
|
||||
p[len] = '\0';
|
||||
}
|
12
lib/util/hashtopass.h
Normal file
12
lib/util/hashtopass.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#include "scrypt_platform.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "warn.h"
|
||||
|
||||
void hashtopass(char* p, size_t len, uint8_t* key);
|
Reference in a new issue