#4400, #5462: Move SSHA1 helpers to crypto-utils

On a way to factoring out OpenSSL support to a standalone file to ease
addition of other crypto libraries support in the future, move helpers
providing SSHA1 password generation and checking to crypto-utils.{c,h}.
This commit is contained in:
Mike Gelfand
2014-12-04 20:45:18 +00:00
parent 5c43b5c23c
commit 748f8a75d2
4 changed files with 79 additions and 80 deletions

View File

@@ -154,6 +154,17 @@ int tr_rand_int_weak (int upper_bound);
bool tr_rand_buffer (void * buffer,
size_t length);
/**
* @brief Generate a SSHA password from its plaintext source.
*/
char * tr_ssha1 (const char * plain_text) TR_GNUC_MALLOC;
/**
* @brief Validate a test password against the a ssha1 password.
*/
bool tr_ssha1_matches (const char * ssha1,
const char * plain_text);
/**
* @brief Translate a block of bytes into base64.
* @return a newly-allocated null-terminated string that can be freed with tr_free ()