From 1ba1bf0c45891ac0f7b68716b77e1b5811b19f40 Mon Sep 17 00:00:00 2001 From: Pliable Pixels Date: Wed, 1 May 2019 13:18:51 -0400 Subject: [PATCH] added test sha1 and bcrypt code to validate working --- src/zm_user.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/zm_user.cpp b/src/zm_user.cpp index 46ee2cdf1..a710188cc 100644 --- a/src/zm_user.cpp +++ b/src/zm_user.cpp @@ -26,6 +26,8 @@ #include #include #include +#include "BCrypt.hpp" +#include "sha1.hpp" #include "zm_utils.h" @@ -95,6 +97,16 @@ User *zmLoadUser( const char *username, const char *password ) { // According to docs, size of safer_whatever must be 2*length+1 due to unicode conversions + null terminator. mysql_real_escape_string(&dbconn, safer_username, username, username_length ); + BCrypt bcrypt; + std::string ptest = "test"; + std::string hash = bcrypt.generateHash(ptest); + Info ("ZM_USER TEST: BCRYPT WORKED AND PRODUCED %s", hash.c_str()); + + SHA1 sha1_checksum; + sha1_checksum.update (ptest); + hash = sha1_checksum.final(); + Info ("ZM_USER TEST: SHA1 WORKED AND PRODUCED %s", hash.c_str()); + if ( password ) { int password_length = strlen(password); char *safer_password = new char[(password_length * 2) + 1];