check
[oweals/gnunet.git] / src / block / block.c
index 8d8018b50276fb085feb1226a5500eed7b42bf6f..24bde02acb2d3bd0438987d81fb585c599eddcba 100644 (file)
@@ -27,7 +27,7 @@
 #include "gnunet_util_lib.h"
 #include "gnunet_signatures.h"
 #include "gnunet_block_lib.h"
-#include "plugin_block.h"
+#include "gnunet_block_plugin.h"
 
 
 /**
@@ -46,6 +46,7 @@ struct Plugin
   struct GNUNET_BLOCK_PluginFunctions *api;
 };
 
+
 /**
  * Handle to an initialized block library.
  */
@@ -63,6 +64,27 @@ struct GNUNET_BLOCK_Context
 };
 
 
+/**
+ * Mingle hash with the mingle_number to produce different bits.
+ * 
+ * @param in original hash code
+ * @param mingle_number number for hash permutation
+ * @param hc where to store the result.
+ */
+void
+GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in,
+                         uint32_t mingle_number, 
+                         GNUNET_HashCode * hc)
+{
+  GNUNET_HashCode m;
+
+  GNUNET_CRYPTO_hash (&mingle_number, 
+                     sizeof (uint32_t), 
+                     &m);
+  GNUNET_CRYPTO_hash_xor (&m, in, hc);
+}
+
+
 /**
  * Create a block context.  Loads the block plugins.
  *
@@ -190,7 +212,7 @@ find_plugin (struct GNUNET_BLOCK_Context *ctx,
  * @param query original query (hash)
  * @param bf pointer to bloom filter associated with query; possibly updated (!)
  * @param bf_mutator mutation value for bf
- * @param xquery extrended query data (can be NULL, depending on type)
+ * @param xquery extended query data (can be NULL, depending on type)
  * @param xquery_size number of bytes in xquery
  * @param reply_block response to validate
  * @param reply_block_size number of bytes in reply block