Version: 0.0.1

home

[report issue]

hasher

Declared in "libtorrent/hasher.hpp"

this is a SHA-1 hash class.

You use it by first instantiating it, then call update() to feed it with data. i.e. you don't have to keep the entire buffer of which you want to create the hash in memory. You can feed the hasher parts of it at a time. When You have fed the hasher with all the data, you call final() and it will return the sha1-hash of the data.

The constructor that takes a char const* and an integer will construct the sha1 context and feed it the data passed in.

If you want to reuse the hasher object once you have created a hash, you have to call reset() to reinitialize it.

The built-in software version of sha1-algorithm was implemented by Steve Reid and released as public domain. For more info, see src/sha1.cpp.

class hasher
{
   hasher ();
   hasher& operator= (hasher const&) &;
   hasher (char const* data, int len);
   hasher (hasher const&);
   explicit hasher (span<char const> data);
   hasher& update (char const* data, int len);
   hasher& update (span<char const> data);
   sha1_hash final ();
   void reset ();
};
[report issue]

operator=() hasher()

hasher& operator= (hasher const&) &;
hasher (char const* data, int len);
hasher (hasher const&);
explicit hasher (span<char const> data);

this is the same as default constructing followed by a call to update(data, len).

[report issue]

update()

hasher& update (char const* data, int len);
hasher& update (span<char const> data);

append the following bytes to what is being hashed

[report issue]

final()

sha1_hash final ();

returns the SHA-1 digest of the buffers previously passed to update() and the hasher constructor.

[report issue]

reset()

void reset ();

restore the hasher state to be as if the hasher has just been default constructed.

[report issue]

hasher256

Declared in "libtorrent/hasher.hpp"

class hasher256
{
   hasher256 ();
   hasher256 (hasher256 const&);
   explicit hasher256 (span<char const> data);
   hasher256& operator= (hasher256 const&) &;
   hasher256 (char const* data, int len);
   hasher256& update (char const* data, int len);
   hasher256& update (span<char const> data);
   sha256_hash final ();
   void reset ();
   ~hasher256 ();
};
[report issue]

hasher256() operator=()

hasher256 (hasher256 const&);
explicit hasher256 (span<char const> data);
hasher256& operator= (hasher256 const&) &;
hasher256 (char const* data, int len);

this is the same as default constructing followed by a call to update(data, len).

[report issue]

update()

hasher256& update (char const* data, int len);
hasher256& update (span<char const> data);

append the following bytes to what is being hashed

[report issue]

final()

sha256_hash final ();

returns the SHA-1 digest of the buffers previously passed to update() and the hasher constructor.

[report issue]

reset()

void reset ();

restore the hasher state to be as if the hasher has just been default constructed.