gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r13016 - gnunet/src/block


From: gnunet
Subject: [GNUnet-SVN] r13016 - gnunet/src/block
Date: Sat, 18 Sep 2010 06:36:48 +0200

Author: grothoff
Date: 2010-09-18 06:36:48 +0200 (Sat, 18 Sep 2010)
New Revision: 13016

Modified:
   gnunet/src/block/Makefile.am
   gnunet/src/block/block.c
   gnunet/src/block/plugin_block_fs.c
Log:
move mingle function

Modified: gnunet/src/block/Makefile.am
===================================================================
--- gnunet/src/block/Makefile.am        2010-09-18 04:34:56 UTC (rev 13015)
+++ gnunet/src/block/Makefile.am        2010-09-18 04:36:48 UTC (rev 13016)
@@ -19,6 +19,7 @@
 libgnunet_plugin_block_fs_la_SOURCES = \
   plugin_block_fs.c
 libgnunet_plugin_block_fs_la_LIBADD = \
+  $(top_builddir)/src/block/libgnunetblock.la \
   $(top_builddir)/src/util/libgnunetutil.la 
 libgnunet_plugin_block_fs_la_LDFLAGS = \
  $(GN_PLUGIN_LDFLAGS)

Modified: gnunet/src/block/block.c
===================================================================
--- gnunet/src/block/block.c    2010-09-18 04:34:56 UTC (rev 13015)
+++ gnunet/src/block/block.c    2010-09-18 04:36:48 UTC (rev 13016)
@@ -46,6 +46,7 @@
   struct GNUNET_BLOCK_PluginFunctions *api;
 };
 
+
 /**
  * Handle to an initialized block library.
  */
@@ -64,6 +65,27 @@
 
 
 /**
+ * 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,
+                         int32_t mingle_number, 
+                         GNUNET_HashCode * hc)
+{
+  GNUNET_HashCode m;
+
+  GNUNET_CRYPTO_hash (&mingle_number, 
+                     sizeof (int32_t), 
+                     &m);
+  GNUNET_CRYPTO_hash_xor (&m, in, hc);
+}
+
+
+/**
  * Create a block context.  Loads the block plugins.
  *
  * @param cfg configuration to use

Modified: gnunet/src/block/plugin_block_fs.c
===================================================================
--- gnunet/src/block/plugin_block_fs.c  2010-09-18 04:34:56 UTC (rev 13015)
+++ gnunet/src/block/plugin_block_fs.c  2010-09-18 04:36:48 UTC (rev 13016)
@@ -38,23 +38,6 @@
 #define BLOOMFILTER_K 16
 
 /**
- * Mingle hash with the mingle_number to produce different bits.
- */
-static void
-mingle_hash (const GNUNET_HashCode * in,
-            int32_t mingle_number, 
-            GNUNET_HashCode * hc)
-{
-  GNUNET_HashCode m;
-
-  GNUNET_CRYPTO_hash (&mingle_number, 
-                     sizeof (int32_t), 
-                     &m);
-  GNUNET_CRYPTO_hash_xor (&m, in, hc);
-}
-
-
-/**
  * Function called to validate a reply or a request.  For
  * request evaluation, simply pass "NULL" for the reply_block.
  * Note that it is assumed that the reply has already been 
@@ -113,7 +96,7 @@
       GNUNET_CRYPTO_hash (reply_block,
                          reply_block_size,
                          &chash);
-      mingle_hash (&chash, bf_mutator, &mhash);
+      GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash);
       if (NULL != *bf)
        {
          if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf,
@@ -154,7 +137,7 @@
       GNUNET_CRYPTO_hash (reply_block,
                          reply_block_size,
                          &chash);
-      mingle_hash (&chash, bf_mutator, &mhash);
+      GNUNET_BLOCK_mingle_hash (&chash, bf_mutator, &mhash);
       if (NULL != *bf)
        {
          if (GNUNET_YES == GNUNET_CONTAINER_bloomfilter_test (*bf,




reply via email to

[Prev in Thread] Current Thread [Next in Thread]