2020-10-21 10:01:57 -04:00
|
|
|
/* Icecast
|
|
|
|
*
|
|
|
|
* This program is distributed under the GNU General Public License, version 2.
|
|
|
|
* A copy of this license is included with this source.
|
|
|
|
*
|
|
|
|
* Copyright 2020, Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DIGEST_H__
|
|
|
|
#define __DIGEST_H__
|
|
|
|
|
|
|
|
#include "refobject.h"
|
|
|
|
|
|
|
|
REFOBJECT_FORWARD_TYPE(digest_t);
|
|
|
|
|
|
|
|
typedef enum {
|
2020-10-21 12:50:11 -04:00
|
|
|
DIGEST_ALGO_MD5,
|
|
|
|
DIGEST_ALGO_SHA3_224,
|
|
|
|
DIGEST_ALGO_SHA3_256,
|
|
|
|
DIGEST_ALGO_SHA3_384,
|
|
|
|
DIGEST_ALGO_SHA3_512
|
2020-10-21 10:01:57 -04:00
|
|
|
} digest_algo_t;
|
|
|
|
|
2020-10-21 12:58:02 -04:00
|
|
|
const char *digest_algo_id2str(digest_algo_t algo);
|
|
|
|
ssize_t digest_algo_length_bytes(digest_algo_t algo);
|
|
|
|
|
|
|
|
digest_t * digest_new(digest_algo_t algo);
|
|
|
|
ssize_t digest_write(digest_t *digest, const void *data, size_t len);
|
|
|
|
ssize_t digest_read(digest_t *digest, void *buf, size_t len);
|
2020-10-21 10:01:57 -04:00
|
|
|
|
|
|
|
/* Returns the digest size in bytes */
|
2020-10-21 12:58:02 -04:00
|
|
|
ssize_t digest_length_bytes(digest_t *digest);
|
2020-10-21 10:01:57 -04:00
|
|
|
|
|
|
|
#endif
|