1 //---------------------------------------------------------------------------//
2 // Copyright (c) 2013-2014 Kyle Lutz <kyle.r.lutz@gmail.com>
4 // Distributed under the Boost Software License, Version 1.0
5 // See accompanying file LICENSE_1_0.txt or copy at
6 // http://www.boost.org/LICENSE_1_0.txt
8 // See http://boostorg.github.com/compute for more information.
9 //---------------------------------------------------------------------------//
11 #ifndef BOOST_COMPUTE_DETAIL_SHA1_HPP
12 #define BOOST_COMPUTE_DETAIL_SHA1_HPP
16 #include <boost/uuid/sha1.hpp>
22 // Accumulates SHA1 hash of the passed strings.
25 sha1(const std::string &s = "") {
26 if (!s.empty()) this->process(s);
29 sha1& process(const std::string &s) {
30 h.process_bytes(s.c_str(), s.size());
34 operator std::string() {
35 unsigned int digest[5];
38 std::ostringstream buf;
39 for(int i = 0; i < 5; ++i)
40 buf << std::hex << std::setfill('0') << std::setw(8) << digest[i];
45 boost::uuids::detail::sha1 h;
48 } // end detail namespace
49 } // end compute namespace
50 } // end boost namespace
53 #endif // BOOST_COMPUTE_DETAIL_SHA1_HPP