Skip to content

Commit

Permalink
Bcript botan
Browse files Browse the repository at this point in the history
  • Loading branch information
HadesD committed Feb 24, 2022
1 parent cb56613 commit ef303c3
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 1,201 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
aux_source_directory(app_helpers APP_HELPERS_SRC)
aux_source_directory(app_helpers/bcrypt APP_HELPERS_BCRYPT_SRC)
# find_library(botan_LIB REQUIRED libbotan-2.a)
# Developer END

include(CheckIncludeFileCXX)
Expand All @@ -30,6 +30,10 @@ set(CMAKE_CXX_EXTENSIONS OFF)

add_executable(${PROJECT_NAME} main.cc)

# Developer START
target_link_libraries(${PROJECT_NAME} PRIVATE botan-2)
# Developer END

# ##############################################################################
# If you include the drogon source code locally in your project, use this method
# to add drogon
Expand Down
9 changes: 5 additions & 4 deletions app_helpers/Utils.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#include "Utils.hpp"

#include "bcrypt/bcrypt.hpp"
#include <botan/bcrypt.h>
#include <botan/rng.h>
#include <botan/system_rng.h>

namespace app_helpers
{
Expand Down Expand Up @@ -42,12 +44,11 @@ namespace app_helpers

std::string bcrypt_hash(const std::string& txt)
{
//! TODO: Fix this
return bcrypt::generateHash(txt);
return Botan::generate_bcrypt(txt, Botan::system_rng(), 10, 'y');
}

bool bcrypt_verify(const std::string& txt, const std::string& hash)
{
return bcrypt::validatePassword(txt, hash);
return Botan::check_bcrypt(txt, hash);
}
}
340 changes: 0 additions & 340 deletions app_helpers/bcrypt/bcrypt.cpp

This file was deleted.

Loading

0 comments on commit ef303c3

Please sign in to comment.