diff --git a/CMakeLists.txt b/CMakeLists.txt index cd27b0f9..2af7aa86 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -485,24 +485,24 @@ endforeach() # Build Documentation # -find_package(Doxygen QUIET) -if(Doxygen_FOUND) - message(STATUS "Building with documentation via Doxygen") +# find_package(Doxygen QUIET) +# if(Doxygen_FOUND) + # message(STATUS "Building with documentation via Doxygen") - #set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in) - set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile) - #configure_file(${DOXYFILE_IN} ${DOXYFILE} @ONLY) + # #set(DOXYFILE_IN ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in) + # set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile) + # #configure_file(${DOXYFILE_IN} ${DOXYFILE} @ONLY) - add_custom_target(DOC - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" - VERBATIM) + # add_custom_target(DOC + # COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYFILE} + # WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + # COMMENT "Generating API documentation with Doxygen" + # VERBATIM) - add_custom_command(TARGET DOC - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/source/doc/Documentation.html ${CMAKE_SOURCE_DIR}/doc - ) - install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc) -endif() + # add_custom_command(TARGET DOC + # POST_BUILD + # COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/source/doc/Documentation.html ${CMAKE_SOURCE_DIR}/doc + # ) + # install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc) +# endif() diff --git a/src_crypt/picrypt.cpp b/src_crypt/picrypt.cpp index 5b683062..8317c6ce 100644 --- a/src_crypt/picrypt.cpp +++ b/src_crypt/picrypt.cpp @@ -151,7 +151,20 @@ PIByteArray PICrypt::hash(const PIString & secret) { #else PICRYPT_DISABLED_WARNING #endif - return hash; + return hash; +} + + +PIByteArray PICrypt::hash(const PIByteArray & data) { + PIByteArray hash; +#ifdef PIP_CRYPT + if (!init()) return hash; + hash.resize(crypto_generichash_BYTES); + crypto_generichash(hash.data(), hash.size(), data.data(), data.size(), (const uchar*)hash_def_key, sizeof(hash_def_key) - 1); +#else + PICRYPT_DISABLED_WARNING +#endif + return hash; } diff --git a/src_main/crypt/picrypt.h b/src_main/crypt/picrypt.h index cf58fbda..6b632d6a 100644 --- a/src_main/crypt/picrypt.h +++ b/src_main/crypt/picrypt.h @@ -54,6 +54,9 @@ public: //! Generate hash from keyphrase "secret", may be used as a key for encryption static PIByteArray hash(const PIString & secret); + //! Generate hash from bytearray + static PIByteArray hash(const PIByteArray & data); + //! Generate short hash from string "s", may be used for hash table static ullong shorthash(const PIString & s, PIByteArray key = PIByteArray());