/* Copyright 2007-2012, Felspar Co Ltd. http://support.felspar.com/ Distributed under the Boost Software License, Version 1.0. See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt */ #include "fost-crypto.hpp" #include #include #include #ifdef __GNUC__ #pragma GCC diagnostic ignored "-Wunused-function" #endif #define CRYPTOPP_ENABLE_NAMESPACE_WEAK 1 #include #include using namespace fostlib; namespace { template< typename H > string hash( const string &text ) { utf8_string toproc( coerce< utf8_string >( text ) ); boost::array< unsigned char, H::DIGESTSIZE > result; H().CalculateDigest( result.data(), reinterpret_cast(toproc.underlying().c_str()), toproc.underlying().length()); return coerce(coerce< hex_string >( result )); } } string fostlib::md5( const string &text ) { return hash(text); } string fostlib::sha1( const string &text ) { return hash(text); }