diff options
Diffstat (limited to 'crypto-scrypt-saltgen.c')
-rw-r--r-- | crypto-scrypt-saltgen.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crypto-scrypt-saltgen.c b/crypto-scrypt-saltgen.c new file mode 100644 index 0000000..82af842 --- /dev/null +++ b/crypto-scrypt-saltgen.c @@ -0,0 +1,25 @@ +#include <stdlib.h> +#include <string.h> +#include <time.h> + +#include "sha256.h" + + +void libscrypt_salt_gen(char *rand, size_t len) +{ + + unsigned char buf[32]; + time_t current_time; + char *c_time_string; + + SHA256_CTX ctx; + + SHA256_Init(&ctx ); + current_time = time(NULL); + c_time_string = ctime(¤t_time); + SHA256_Update(&ctx, c_time_string, strlen(c_time_string)); + SHA256_Final(buf, &ctx); + + memcpy(rand, buf, len); + +} |