// Copyright (c) 2018-2019 Zano Project // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "crypto_stream_operators.h" bool parse_hash256(const std::string str_hash, crypto::hash& hash) { std::string buf; bool res = epee::string_tools::parse_hexstr_to_binbuff(str_hash, buf); if (!res || buf.size() != sizeof(crypto::hash)) { std::cout << "invalid hash format: <" << str_hash << '>' << std::endl; return false; } buf.copy(reinterpret_cast(&hash), sizeof(crypto::hash)); return true; }