forked from ethereum/solidity
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59dbf8f
commit f658140
Showing
7 changed files
with
533 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
include(ExternalProject) | ||
include(GNUInstallDirs) | ||
|
||
set(BOOST_CXXFLAGS "") | ||
if (WIN32) | ||
set(BOOST_BOOTSTRAP_COMMAND bootstrap.bat) | ||
set(BOOST_BUILD_TOOL b2.exe) | ||
set(BOOST_LIBRARY_SUFFIX -vc140-mt-1_63.lib) | ||
else() | ||
set(BOOST_BOOTSTRAP_COMMAND ./bootstrap.sh) | ||
set(BOOST_BUILD_TOOL ./b2) | ||
set(BOOST_LIBRARY_SUFFIX .a) | ||
if (${BUILD_SHARED_LIBS}) | ||
set(BOOST_CXXFLAGS "cxxflags=-fPIC") | ||
endif() | ||
endif() | ||
|
||
#set(BOOST_CXXFLAGS "cxxflags=-Wa,-march=generic64") | ||
set(BOOST_CXXFLAGS "cxxflags=-fPIC") | ||
|
||
ExternalProject_Add(boost | ||
PREFIX ${CMAKE_SOURCE_DIR}/deps | ||
DOWNLOAD_NO_PROGRESS 1 | ||
URL https://github.com/ethereum/cpp-dependencies/releases/download/cache/boost_1_63_0.tar.gz | ||
URL_HASH SHA256=fe34a4e119798e10b8cc9e565b3b0284e9fd3977ec8a1b19586ad1dec397088b | ||
BUILD_IN_SOURCE 1 | ||
CONFIGURE_COMMAND ${BOOST_BOOTSTRAP_COMMAND} | ||
LOG_CONFIGURE 1 | ||
BUILD_COMMAND ${BOOST_BUILD_TOOL} stage | ||
${BOOST_CXXFLAGS} | ||
threading=multi | ||
link=static | ||
variant=release | ||
address-model=64 | ||
--with-thread | ||
--with-date_time | ||
--with-system | ||
--with-regex | ||
--with-chrono | ||
--with-filesystem | ||
--with-program_options | ||
--with-random | ||
LOG_BUILD 1 | ||
INSTALL_COMMAND "" | ||
) | ||
|
||
ExternalProject_Get_Property(boost SOURCE_DIR) | ||
set(Boost_INCLUDE_DIRS ${SOURCE_DIR}) | ||
set(Boost_LIBRARIES ${SOURCE_DIR}/stage/lib) | ||
unset(BUILD_DIR) | ||
|
||
add_library(Boost::Chrono STATIC IMPORTED) | ||
set_property(TARGET Boost::Chrono PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_chrono${BOOST_LIBRARY_SUFFIX}) | ||
add_dependencies(Boost::Chrono boost) | ||
|
||
add_library(Boost::DataTime STATIC IMPORTED) | ||
set_property(TARGET Boost::DataTime PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_date_time${BOOST_LIBRARY_SUFFIX}) | ||
add_dependencies(Boost::DataTime boost) | ||
|
||
add_library(Boost::Regex STATIC IMPORTED) | ||
set_property(TARGET Boost::Regex PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_regex${BOOST_LIBRARY_SUFFIX}) | ||
add_dependencies(Boost::Regex boost) | ||
|
||
add_library(Boost::System STATIC IMPORTED) | ||
set_property(TARGET Boost::System PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_system${BOOST_LIBRARY_SUFFIX}) | ||
add_dependencies(Boost::System boost) | ||
|
||
add_library(Boost::Filesystem STATIC IMPORTED) | ||
set_property(TARGET Boost::Filesystem PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_filesystem${BOOST_LIBRARY_SUFFIX}) | ||
set_property(TARGET Boost::Filesystem PROPERTY INTERFACE_LINK_LIBRARIES Boost::System) | ||
add_dependencies(Boost::Filesystem boost) | ||
|
||
add_library(Boost::Random STATIC IMPORTED) | ||
set_property(TARGET Boost::Random PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_random${BOOST_LIBRARY_SUFFIX}) | ||
add_dependencies(Boost::Random boost) | ||
|
||
add_library(Boost::ProgramOptions STATIC IMPORTED) | ||
set_property(TARGET Boost::ProgramOptions PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_program_options${BOOST_LIBRARY_SUFFIX}) | ||
add_dependencies(Boost::ProgramOptions boost) | ||
|
||
add_library(Boost::UnitTestFramework STATIC IMPORTED) | ||
set_property(TARGET Boost::UnitTestFramework PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_unit_test_framework${BOOST_LIBRARY_SUFFIX}) | ||
add_dependencies(Boost::UnitTestFramework boost) | ||
|
||
add_library(Boost::Thread STATIC IMPORTED) | ||
set_property(TARGET Boost::Thread PROPERTY IMPORTED_LOCATION ${Boost_LIBRARIES}/libboost_thread${BOOST_LIBRARY_SUFFIX}) | ||
set_property(TARGET Boost::Thread PROPERTY INTERFACE_LINK_LIBRARIES Boost::Chrono Boost::DataTime Boost::Regex) | ||
add_dependencies(Boost::Thread boost) | ||
|
||
set(Boost_FILESYSTEM_LIBRARIES Boost::Filesystem) | ||
set(Boost_REGEX_LIBRARIES Boost::Regex) | ||
set(Boost_SYSTEM_LIBRARIES Boost::System) | ||
set(CMAKE_THREAD_LIBS_INIT Boost::Thread) | ||
set(Boost_PROGRAM_OPTIONS_LIBRARIES Boost::ProgramOptions) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/* | ||
This file is part of FISCO-BCOS. | ||
FISCO-BCOS is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
FISCO-BCOS is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with FISCO-BCOS. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
/** @file GmHash.cpp | ||
* @author asherli | ||
* @date 2018 | ||
*/ | ||
|
||
#include <libdevcore/SHA3.h> | ||
|
||
#include "sm3/sm3.h" | ||
#include <cstdint> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
#include <cstring> | ||
|
||
using namespace std; | ||
using namespace dev; | ||
|
||
namespace dev { | ||
|
||
// add SM3 | ||
bool sha3(bytesConstRef _input, bytesRef o_output) { | ||
if (o_output.size() != 32) | ||
return false; | ||
|
||
SM3((unsigned char *)_input.data(), _input.size(), | ||
(unsigned char *)o_output.data()); | ||
return true; | ||
} | ||
|
||
bool keccak256(bytesConstRef _input, bytesRef o_output) { | ||
if (o_output.size() != 32) | ||
return false; | ||
SM3((unsigned char *)_input.data(), _input.size(), (unsigned char *)o_output.data()); | ||
return true; | ||
} | ||
|
||
} // namespace dev |
Oops, something went wrong.