23 lines
532 B
C
23 lines
532 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
#include <cli.h>
|
|
#include <libft_ssl.h>
|
|
|
|
#include "ft_ssl.h"
|
|
#include "internal/cmd/digest.h"
|
|
|
|
int
|
|
digest_run_string(const struct digest_config *config, const char *s)
|
|
{
|
|
union digest_ctx ctx;
|
|
uint8_t digest[MAX_DIGEST_SIZE];
|
|
char label[4096];
|
|
|
|
config->algo->init(&ctx);
|
|
config->algo->update(&ctx, (const uint8_t *)s, strlen(s));
|
|
config->algo->final(&ctx, digest);
|
|
(void)snprintf(label, sizeof(label), "\"%s\"", s);
|
|
print_digest(config, digest, label, 1);
|
|
return CLI_SUCCESS;
|
|
}
|