diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-09-18 04:36:48 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-09-18 04:36:48 +0000 |
commit | 4346e3b1d6f830c8862fda17262fe0a41359be10 (patch) | |
tree | b3f2add02a3d70c58c8b93cdaf619910ec2ce37a /src/block/block.c | |
parent | 29fa331cfde73bde39cb365f05a64fbe8583c41c (diff) | |
download | gnunet-4346e3b1d6f830c8862fda17262fe0a41359be10.tar.gz gnunet-4346e3b1d6f830c8862fda17262fe0a41359be10.zip |
move mingle function
Diffstat (limited to 'src/block/block.c')
-rw-r--r-- | src/block/block.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/block/block.c b/src/block/block.c index 8d8018b50..29382dad1 100644 --- a/src/block/block.c +++ b/src/block/block.c | |||
@@ -46,6 +46,7 @@ struct Plugin | |||
46 | struct GNUNET_BLOCK_PluginFunctions *api; | 46 | struct GNUNET_BLOCK_PluginFunctions *api; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | |||
49 | /** | 50 | /** |
50 | * Handle to an initialized block library. | 51 | * Handle to an initialized block library. |
51 | */ | 52 | */ |
@@ -64,6 +65,27 @@ struct GNUNET_BLOCK_Context | |||
64 | 65 | ||
65 | 66 | ||
66 | /** | 67 | /** |
68 | * Mingle hash with the mingle_number to produce different bits. | ||
69 | * | ||
70 | * @param in original hash code | ||
71 | * @param mingle_number number for hash permutation | ||
72 | * @param hc where to store the result. | ||
73 | */ | ||
74 | void | ||
75 | GNUNET_BLOCK_mingle_hash (const GNUNET_HashCode * in, | ||
76 | int32_t mingle_number, | ||
77 | GNUNET_HashCode * hc) | ||
78 | { | ||
79 | GNUNET_HashCode m; | ||
80 | |||
81 | GNUNET_CRYPTO_hash (&mingle_number, | ||
82 | sizeof (int32_t), | ||
83 | &m); | ||
84 | GNUNET_CRYPTO_hash_xor (&m, in, hc); | ||
85 | } | ||
86 | |||
87 | |||
88 | /** | ||
67 | * Create a block context. Loads the block plugins. | 89 | * Create a block context. Loads the block plugins. |
68 | * | 90 | * |
69 | * @param cfg configuration to use | 91 | * @param cfg configuration to use |