2015-01-01 21:25:39 +01:00
|
|
|
/*
|
|
|
|
SHA-1 C++ conversion
|
|
|
|
|
|
|
|
original version:
|
|
|
|
|
|
|
|
SHA-1 in C
|
|
|
|
By Steve Reid <sreid@sea-to-sky.net>
|
|
|
|
100% Public Domain
|
|
|
|
|
|
|
|
changelog at the end of sha1.cpp
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TORRENT_SHA1_HPP_INCLUDED
|
|
|
|
#define TORRENT_SHA1_HPP_INCLUDED
|
|
|
|
|
|
|
|
#include "libtorrent/config.hpp"
|
2016-06-18 20:01:38 +02:00
|
|
|
#include <cstdint>
|
2015-01-01 21:25:39 +01:00
|
|
|
|
|
|
|
namespace libtorrent
|
|
|
|
{
|
|
|
|
|
2016-08-26 01:07:16 +02:00
|
|
|
struct sha1_ctx
|
2015-01-01 21:25:39 +01:00
|
|
|
{
|
2016-06-18 20:01:38 +02:00
|
|
|
std::uint32_t state[5];
|
|
|
|
std::uint32_t count[2];
|
|
|
|
std::uint8_t buffer[64];
|
2015-01-01 21:25:39 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// we don't want these to clash with openssl's libcrypto
|
2016-08-26 01:07:16 +02:00
|
|
|
TORRENT_EXTRA_EXPORT void SHA1_init(sha1_ctx* context);
|
|
|
|
TORRENT_EXTRA_EXPORT void SHA1_update(sha1_ctx* context
|
|
|
|
, std::uint8_t const* data, std::uint32_t len);
|
|
|
|
TORRENT_EXTRA_EXPORT void SHA1_final(std::uint8_t* digest, sha1_ctx* context);
|
2015-01-01 21:25:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|