API — ICoreEssentials/Crypto
The public contract of 1 header(s) under src/ICoreEssentials/Crypto — 1 class/struct definition(s), 6 declaration(s). Each section shows the header's banner and its public (and protected-virtual) surface exactly as the file writes it.
| Header | Defines | Declarations | Bases |
|---|---|---|---|
ICoreHash.h | ICoreHash | 6 | — |
ICoreHash.h#
src/ICoreEssentials/Crypto/ICoreHash.h
ICoreHash -- a content digest.
QT-FREE (phase 3). SHA-1 is implemented here, in 60 lines against RFC 3174, and <QCryptographicHash> is gone from this header and from the umbrella.
B2 is why this row was small. It narrowed the wrapper to ONE algorithm out of QCryptographicHash's fourteen and to a raw (pointer, length) addData, so phase 3 owed one hash function rather than a crypto library -- exactly the bargain ICoreStandardPaths struck when its narrowing turned a known-folders implementation into a PATH walk.
THE DIGEST MUST NOT CHANGE, and this is the one wrapper where that is a data-format promise rather than a nicety. ICoreStudioStateMachine hashes a pixmap to NAME THE FILE it is saved as, so a project on disk already contains
ICoreHash#
ICoreHash.h:61 · class · pImpl · 6 declaration(s)
class ICoreHash {
public:
// One enumerator, because one is used. See the header note before adding
// a second.
enum class Algorithm {
Sha1
};
explicit ICoreHash(Algorithm algorithm);
~ICoreHash();
// Copyable, as it always was -- a half-fed hash is a value, and copying one
// to fork two different endings off it is meaningful. Written out because a
// unique_ptr<Impl> member deletes the implicit copy.
ICoreHash(const ICoreHash& other);
ICoreHash& operator=(const ICoreHash& other);
void addData(const void* data, std::size_t size);
// const, and therefore NON-DESTRUCTIVE: the padding is applied to a copy of
// the state, so asking twice gives the same answer and addData may continue
// afterwards. QCryptographicHash::result() behaves the same way, and the
// call site relies on it only to the extent that it asks once.
[[nodiscard]] ICoreString resultHex() const;
private:
class Impl; // the two-line residue; state lives here
std::unique_ptr<Impl> impl;
};