Advertisement
Guest User

Untitled

a guest
Apr 9th, 2014
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. void libscrypt_salt_gen(uint8_t *rand, size_t len)
  2. {
  3.  
  4. unsigned char buf[32];
  5. time_t current_time;
  6. char *c_time_string;
  7.  
  8. SHA256_CTX ctx;
  9.  
  10. SHA256_Init(&ctx );
  11. current_time = time(NULL);
  12. c_time_string = ctime(&current_time);
  13. SHA256_Update(&ctx, c_time_string, strlen(c_time_string));
  14. SHA256_Final(buf, &ctx);
  15.  
  16. memcpy(rand, buf, len);
  17.  
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement