Stores a SHA1 hash.
More...
#include <sha1hash.h>
- Author
- Joris Guisson This class keeps track of a SHA1 hash. A SHA1 hash is a 20 byte array of bytes.
Definition at line 40 of file sha1hash.h.
◆ SHA1Hash() [1/3]
bt::SHA1Hash::SHA1Hash |
( |
| ) |
|
Constructor, sets every byte in the hash to 0.
◆ SHA1Hash() [2/3]
bt::SHA1Hash::SHA1Hash |
( |
const SHA1Hash & |
other | ) |
|
Copy constructor.
- Parameters
-
◆ SHA1Hash() [3/3]
bt::SHA1Hash::SHA1Hash |
( |
const Uint8 * |
h | ) |
|
Directly set the hash data.
- Parameters
-
h | The hash data must be 20 bytes large |
◆ ~SHA1Hash()
virtual bt::SHA1Hash::~SHA1Hash |
( |
| ) |
|
|
virtual |
◆ generate()
static SHA1Hash bt::SHA1Hash::generate |
( |
const Uint8 * |
data, |
|
|
Uint32 |
len |
|
) |
| |
|
static |
Generate an SHA1 hash from a bunch of data.
- Parameters
-
data | The data |
len | Size in bytes of data |
- Returns
- The generated SHA1 hash
◆ getData()
const Uint8* bt::SHA1Hash::getData |
( |
| ) |
const |
|
inline |
Directly get pointer to the data.
- Returns
- The data
Definition at line 114 of file sha1hash.h.
◆ operator!=()
bool bt::SHA1Hash::operator!= |
( |
const SHA1Hash & |
other | ) |
const |
|
inline |
Test whether another hash is not equal to this one.
- Parameters
-
- Returns
- true if not equal, false otherwise
Definition at line 88 of file sha1hash.h.
◆ operator=()
Assignment operator.
- Parameters
-
◆ operator==()
bool bt::SHA1Hash::operator== |
( |
const SHA1Hash & |
other | ) |
const |
Test whether another hash is equal to this one.
- Parameters
-
- Returns
- true if equal, false otherwise
◆ toByteArray()
QByteArray bt::SHA1Hash::toByteArray |
( |
| ) |
const |
Convert the hash to a byte array.
◆ toString()
QString bt::SHA1Hash::toString |
( |
| ) |
const |
Convert the hash to a printable string.
- Returns
- The string
◆ toURLString()
QString bt::SHA1Hash::toURLString |
( |
| ) |
const |
Convert the hash to a string, usable in http get requests.
- Returns
- The string
◆ operator<
KTORRENT_EXPORT friend bool operator< |
( |
const SHA1Hash & |
a, |
|
|
const SHA1Hash & |
b |
|
) |
| |
|
friend |
Function to compare 2 hashes
- Parameters
-
a | The first hash |
h | The second hash |
- Returns
- whether a is smaller then b
◆ operator<<
KTORRENT_EXPORT friend Log& operator<< |
( |
Log & |
out, |
|
|
const SHA1Hash & |
h |
|
) |
| |
|
friend |
Function to print a SHA1Hash to the Log.
- Parameters
-
- Returns
- out
◆ operator^
XOR two SHA1Hashes
- Parameters
-
a | The first hash |
b | The second |
- Returns
- a xor b
◆ qHash
KTORRENT_EXPORT friend uint qHash |
( |
const SHA1Hash & |
key | ) |
|
|
friend |
Function to support the use of SHA1Hash as QHash keys
- Parameters
-
- Returns
- hash key
The documentation for this class was generated from the following file: