summaryrefslogtreecommitdiff
path: root/src/libstdcrypto/blake2s_final.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstdcrypto/blake2s_final.c')
-rw-r--r--src/libstdcrypto/blake2s_final.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/libstdcrypto/blake2s_final.c b/src/libstdcrypto/blake2s_final.c
new file mode 100644
index 0000000..207d60b
--- /dev/null
+++ b/src/libstdcrypto/blake2s_final.c
@@ -0,0 +1,16 @@
+ /* ISC license. */
+
+#include <string.h>
+
+#include <skalibs/uint32.h>
+#include <skalibs/blake2s.h>
+#include "blake2s-internal.h"
+
+void blake2s_final (blake2s_ctx *ctx, char *out)
+{
+ ctx->f[0] = -1 ;
+ memset(ctx->buf + ctx->buflen, 0, 64 - ctx->buflen) ;
+ blake2s_transform(ctx, ctx->buf, 1, ctx->buflen) ;
+ uint32_littlen(ctx->h, 8) ;
+ memcpy(out, ctx->h, ctx->outlen) ;
+}