ucommon
7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
![]() ![]() |
A cryptographic digest class. More...
#include <secure.h>
Public Member Functions | |
Digest (const char *type) | |
Digest () | |
~Digest () | |
bool | puts (const char *str) |
Digest & | operator<< (const char *str) |
Digest & | operator<< (int16_t value) |
Digest & | operator<< (int32_t value) |
Digest & | operator<< (const PrintProtocol &p) |
bool | put (const void *memory, size_t size) |
unsigned | size () const |
secure::keybytes | key (void) |
secure::string | str (void) |
operator secure::string () | |
void | set (const char *id) |
Digest & | operator= (const char *id) |
bool | operator*= (const char *text) |
bool | operator+= (const char *text) |
secure::string | operator* () |
bool | operator! () const |
operator bool () const | |
void | recycle (bool binary=false) |
Finalize and recycle current digest to start a new digest. More... | |
void | reset (void) |
Reset and restart digest object. More... | |
Static Public Member Functions | |
static bool | has (const char *name) |
Test to see if a specific digest type is supported. More... | |
static secure::string | uuid (const char *name, const uint8_t *ns=NULL) |
static secure::string | md5 (const char *text) |
Shortcut for short md5 digests if supported... More... | |
static secure::string | sha1 (const char *text) |
static secure::string | sha256 (const char *text) |
static secure::string | sha384 (const char *text) |
static secure::keybytes | md5 (const uint8_t *mem, size_t size) |
static secure::keybytes | sha1 (const uint8_t *mem, size_t size) |
static secure::keybytes | sha256 (const uint8_t *mem, size_t size) |
static secure::keybytes | sha384 (const uint8_t *mem, size_t size) |
Protected Member Functions | |
void | release (void) |
const uint8_t * | get (void) |
Private Member Functions | |
__DELETE_COPY (Digest) | |
Private Attributes | |
void * | context |
union { | |
const void * hashtype | |
int hashid | |
}; | |
unsigned | bufsize |
uint8_t | buffer [512/8] |
char | textbuf [512/8+1] |
A cryptographic digest class.
This class can support md5 digests, sha1, sha256, etc, depending on what the underlying library supports. The hash class accumulates the hash in the object.
ucommon::Digest::Digest | ( | const char * | type | ) |
ucommon::Digest::Digest | ( | ) |
ucommon::Digest::~Digest | ( | ) |
Definition at line 58 of file common.cpp.
References buffer, and release().
|
private |
|
protected |
|
static |
Test to see if a specific digest type is supported.
name | of digest we want to check. |
Definition at line 69 of file digest.cpp.
References ucommon::__context::map_digest().
Referenced by main(), md5(), sha1(), sha256(), sha384(), and uuid().
secure::keybytes ucommon::Digest::key | ( | void | ) |
Definition at line 75 of file common.cpp.
References buffer, bufsize, and get().
|
static |
Shortcut for short md5 digests if supported...
text | to create a digest for. |
Definition at line 155 of file common.cpp.
References digest(), and has().
|
static |
Definition at line 111 of file common.cpp.
References digest(), has(), and size().
|
inline |
Definition at line 575 of file secure.h.
References ucommon::str().
|
inline |
Definition at line 594 of file secure.h.
References ucommon::str().
|
inline |
|
inline |
|
inline |
Definition at line 541 of file secure.h.
References ucommon::str().
|
inline |
Definition at line 558 of file secure.h.
References ucommon::PrintProtocol::_print().
|
inline |
|
inline |
|
inline |
bool ucommon::Digest::put | ( | const void * | memory, |
size_t | size | ||
) |
|
inline |
Definition at line 537 of file secure.h.
References ucommon::str().
void ucommon::Digest::recycle | ( | bool | binary = false | ) |
|
protected |
void ucommon::Digest::reset | ( | void | ) |
Reset and restart digest object.
Definition at line 88 of file digest.cpp.
References bufsize, context, hashid, MAX_DIGEST_HASHSIZE, and temp.
void ucommon::Digest::set | ( | const char * | id | ) |
Definition at line 53 of file digest.cpp.
References context, hashid, ucommon::secure::init(), ucommon::__context::map_digest(), and release().
Referenced by Digest().
|
static |
Definition at line 165 of file common.cpp.
References digest(), and has().
|
static |
Definition at line 122 of file common.cpp.
References digest(), has(), and size().
|
static |
Definition at line 175 of file common.cpp.
References digest(), and has().
|
static |
Definition at line 133 of file common.cpp.
References digest(), has(), and size().
|
static |
Definition at line 185 of file common.cpp.
References digest(), and has().
|
static |
Definition at line 144 of file common.cpp.
References digest(), has(), and size().
|
inline |
secure::string ucommon::Digest::str | ( | void | ) |
|
static |
Definition at line 86 of file common.cpp.
References has(), ucommon::String::hexdump(), md, and str().
union { ... } ucommon::Digest::@18 |
|
private |
|
private |
|
private |
int ucommon::Digest::hashid |
const void* ucommon::Digest::hashtype |
|
private |