![]() |
libwebsockets
Lightweight C library for HTML5 websockets
|
Data Structures | |
struct | lws_genhash_ctx |
Functions | |
LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT | lws_genhash_size (int type) |
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT | lws_genhash_init (struct lws_genhash_ctx *ctx, int type) |
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT | lws_genhash_update (struct lws_genhash_ctx *ctx, const void *in, size_t len) |
LWS_VISIBLE LWS_EXTERN int | lws_genhash_destroy (struct lws_genhash_ctx *ctx, void *result) |
Lws provides generic hash / digest accessors that abstract the ones provided by whatever OpenSSL library you are linking against.
It lets you use the same code if you build against mbedtls or OpenSSL for example.
LWS_VISIBLE LWS_EXTERN int lws_genhash_destroy | ( | struct lws_genhash_ctx * | ctx, |
void * | result | ||
) |
#include <lib/libwebsockets.h>
lws_genhash_destroy() - copy out the result digest and destroy the ctx
ctx | your struct lws_genhash_ctx |
result | NULL, or where to copy the result hash |
Finalizes the hash and copies out the digest. Destroys any allocations such that ctx can safely go out of scope after calling this.
NULL result is supported so that you can destroy the ctx cleanly on error conditions, where there is no valid result.
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_genhash_init | ( | struct lws_genhash_ctx * | ctx, |
int | type | ||
) |
#include <lib/libwebsockets.h>
lws_genhash_init() - prepare your struct lws_genhash_ctx for use
ctx | your struct lws_genhash_ctx |
type | one of LWS_GENHASH_TYPE_... |
Initializes the hash context for the type you requested
LWS_VISIBLE LWS_EXTERN size_t LWS_WARN_UNUSED_RESULT lws_genhash_size | ( | int | type | ) |
#include <lib/libwebsockets.h>
lws_genhash_size() - get hash size in bytes
type | one of LWS_GENHASH_TYPE_... |
Returns number of bytes in this type of hash
LWS_VISIBLE LWS_EXTERN int LWS_WARN_UNUSED_RESULT lws_genhash_update | ( | struct lws_genhash_ctx * | ctx, |
const void * | in, | ||
size_t | len | ||
) |
#include <lib/libwebsockets.h>
lws_genhash_update() - digest len bytes of the buffer starting at in
ctx | your struct lws_genhash_ctx |
in | start of the bytes to digest |
len | count of bytes to digest |
Updates the state of your hash context to reflect digesting len bytes from in