Strophe 0.12
XMPP client library
|
Functions | |
char * | xmpp_sha1 (xmpp_ctx_t *ctx, const unsigned char *data, size_t len) |
Compute SHA1 message digest. | |
void | xmpp_sha1_digest (const unsigned char *data, size_t len, unsigned char *digest) |
Compute SHA1 message digest. | |
xmpp_sha1_t * | xmpp_sha1_new (xmpp_ctx_t *ctx) |
Create new SHA1 object. | |
void | xmpp_sha1_free (xmpp_sha1_t *sha1) |
Destroy SHA1 object. | |
void | xmpp_sha1_update (xmpp_sha1_t *sha1, const unsigned char *data, size_t len) |
Update SHA1 context with the next portion of data. | |
void | xmpp_sha1_final (xmpp_sha1_t *sha1) |
Finish SHA1 computation. | |
char * | xmpp_sha1_to_string (xmpp_sha1_t *sha1, char *s, size_t slen) |
Return message digest rendered as a string. | |
char * | xmpp_sha1_to_string_alloc (xmpp_sha1_t *sha1) |
Return message digest rendered as a string. | |
void | xmpp_sha1_to_digest (xmpp_sha1_t *sha1, unsigned char *digest) |
Stores message digest to a user's buffer. | |
char * xmpp_sha1 | ( | xmpp_ctx_t * | ctx, |
const unsigned char * | data, | ||
size_t | len | ||
) |
Compute SHA1 message digest.
Returns an allocated string which represents SHA1 message digest in hexadecimal notation. The string must be freed with xmpp_free().
ctx | a Strophe context object |
data | buffer for digest computation |
len | size of the data buffer |
void xmpp_sha1_digest | ( | const unsigned char * | data, |
size_t | len, | ||
unsigned char * | digest | ||
) |
Compute SHA1 message digest.
Stores digest in user's buffer which must be at least XMPP_SHA1_DIGEST_SIZE bytes long.
data | buffer for digest computation |
len | size of the data buffer |
digest | output buffer of XMPP_SHA1_DIGEST_SIZE bytes |
xmpp_sha1_t * xmpp_sha1_new | ( | xmpp_ctx_t * | ctx | ) |
Create new SHA1 object.
SHA1 object is used to compute SHA1 digest of a buffer that is split in multiple chunks or provided in stream mode. A single buffer can be processed by short functions xmpp_sha1() and xmpp_sha1_digest(). Follow the next use-case for xmpp_sha1_t object:
ctx | a Strophe context object |
void xmpp_sha1_free | ( | xmpp_sha1_t * | sha1 | ) |
Destroy SHA1 object.
sha1 | a SHA1 object |
void xmpp_sha1_update | ( | xmpp_sha1_t * | sha1, |
const unsigned char * | data, | ||
size_t | len | ||
) |
Update SHA1 context with the next portion of data.
Can be called repeatedly.
sha1 | a SHA1 object |
data | pointer to a buffer to be hashed |
len | size of the data buffer |
void xmpp_sha1_final | ( | xmpp_sha1_t * | sha1 | ) |
Finish SHA1 computation.
Don't call xmpp_sha1_update() after this function. Retrieve resulting message digest with xmpp_sha1_to_string() or xmpp_sha1_to_digest().
sha1 | a SHA1 object |
char * xmpp_sha1_to_string | ( | xmpp_sha1_t * | sha1, |
char * | s, | ||
size_t | slen | ||
) |
Return message digest rendered as a string.
Stores the string to a user's buffer and returns the buffer. Call this function after xmpp_sha1_final().
sha1 | a SHA1 object |
s | output string |
slen | size reserved for the string including '\0' |
char * xmpp_sha1_to_string_alloc | ( | xmpp_sha1_t * | sha1 | ) |
Return message digest rendered as a string.
Returns an allocated string. Free the string by calling xmpp_free() using the Strophe context which is passed to xmpp_sha1_new(). Call this function after xmpp_sha1_final().
sha1 | a SHA1 object |
void xmpp_sha1_to_digest | ( | xmpp_sha1_t * | sha1, |
unsigned char * | digest | ||
) |
Stores message digest to a user's buffer.
sha1 | a SHA1 object |
digest | output buffer of XMPP_SHA1_DIGEST_SIZE bytes |