2015-05-26 06:38:12 +02:00
|
|
|
#include "shadouble.h"
|
2015-10-26 11:35:28 +01:00
|
|
|
#include <ccan/mem/mem.h>
|
2018-03-08 04:24:14 +01:00
|
|
|
#include <common/type_to_string.h>
|
2015-05-26 06:38:12 +02:00
|
|
|
|
|
|
|
void sha256_double(struct sha256_double *shadouble, const void *p, size_t len)
|
|
|
|
{
|
2015-10-26 11:35:28 +01:00
|
|
|
sha256(&shadouble->sha, memcheck(p, len), len);
|
2015-05-27 06:25:20 +02:00
|
|
|
sha256(&shadouble->sha, &shadouble->sha, sizeof(shadouble->sha));
|
2015-05-26 06:38:12 +02:00
|
|
|
}
|
|
|
|
|
2015-05-27 06:25:20 +02:00
|
|
|
void sha256_double_done(struct sha256_ctx *shactx, struct sha256_double *res)
|
2015-05-26 06:38:12 +02:00
|
|
|
{
|
2015-05-27 06:25:20 +02:00
|
|
|
sha256_done(shactx, &res->sha);
|
|
|
|
sha256(&res->sha, &res->sha, sizeof(res->sha));
|
2015-05-26 06:38:12 +02:00
|
|
|
}
|
2018-03-08 04:24:14 +01:00
|
|
|
REGISTER_TYPE_TO_HEXSTR(sha256_double);
|