aboutsummaryrefslogtreecommitdiff
path: root/libcmix/cmix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libcmix/cmix.c')
-rw-r--r--libcmix/cmix.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/libcmix/cmix.c b/libcmix/cmix.c
index 9db4dbb..f6eb2e8 100644
--- a/libcmix/cmix.c
+++ b/libcmix/cmix.c
@@ -3,6 +3,7 @@
#include <string.h>
#include <stdlib.h>
+#include <stdio.h>
enum cmix_error permutation(struct CMixBuffer b) {
return no_error;
@@ -336,3 +337,21 @@ enum cmix_error remove_r_and_s(struct CMixContext const* ctx, char* out_buffer,
ctx->api.free_group_element(inv_pirs);
ctx->api.free_group_element(mult);
}
+
+enum cmix_error get_pub_key_hash(struct CMixContext const* ctx, char** buffer)
+{
+ char* buffer2;
+ size_t len;
+ ctx->api.get_pub_key_hash(&buffer2, &len, ctx->keypair.pub);
+
+ size_t hex_len = len*2+1;
+ *buffer = (char*) calloc(hex_len, sizeof(char));
+
+ for(size_t i = 0; i < len; i++) {
+ sprintf(&(*buffer)[i*2],"%hhX",buffer2[i]);
+ }
+
+ ctx->api.free_buffer(buffer2);
+
+ return no_error;
+}