aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-09 16:27:28 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-09 16:27:28 +0000
commit712767683a32140be3fd7d195b44be676853eb12 (patch)
treece558dd6d53a94f983aac55dafc56351641802a1 /src/include
parentefd634ccf636b870b2dbd79f8969f8999c5573fa (diff)
downloadgnunet-712767683a32140be3fd7d195b44be676853eb12.tar.gz
gnunet-712767683a32140be3fd7d195b44be676853eb12.zip
adding API for incremental hashing (from Taler)
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_crypto_lib.h52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index dbfcf8ea2..ae899c1db 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -633,7 +633,57 @@ GNUNET_CRYPTO_hash_distance_u32 (const struct GNUNET_HashCode *a,
633 * @param ret pointer to where to write the hashcode 633 * @param ret pointer to where to write the hashcode
634 */ 634 */
635void 635void
636GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode * ret); 636GNUNET_CRYPTO_hash (const void *block,
637 size_t size,
638 struct GNUNET_HashCode *ret);
639
640
641/**
642 * Context for cummulative hashing.
643 */
644struct GNUNET_HashContext;
645
646
647/**
648 * Start incremental hashing operation.
649 *
650 * @return context for incremental hash computation
651 */
652struct GNUNET_HashContext *
653GNUNET_CRYPTO_hash_context_start (void);
654
655
656/**
657 * Add data to be hashed.
658 *
659 * @param hc cummulative hash context
660 * @param buf data to add
661 * @param size number of bytes in @a buf
662 */
663void
664GNUNET_CRYPTO_hash_context_read (struct GNUNET_HashContext *hc,
665 const void *buf,
666 size_t size);
667
668
669/**
670 * Finish the hash computation.
671 *
672 * @param hc hash context to use, is freed in the process
673 * @param r_hash where to write the latest / final hash code
674 */
675void
676GNUNET_CRYPTO_hash_context_finish (struct GNUNET_HashContext *hc,
677 struct GNUNET_HashCode *r_hash);
678
679
680/**
681 * Abort hashing, do not bother calculating final result.
682 *
683 * @param hc hash context to destroy
684 */
685void
686GNUNET_CRYPTO_hash_context_abort (struct GNUNET_HashContext *hc);
637 687
638 688
639/** 689/**