gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20611 - gnunet/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r20611 - gnunet/src/namestore
Date: Mon, 19 Mar 2012 18:11:46 +0100

Author: wachs
Date: 2012-03-19 18:11:46 +0100 (Mon, 19 Mar 2012)
New Revision: 20611

Modified:
   gnunet/src/namestore/gnunet-namestore.c
   gnunet/src/namestore/gnunet-service-namestore.c
   gnunet/src/namestore/namestore.h
   gnunet/src/namestore/namestore_api.c
   gnunet/src/namestore/namestore_common.c
   gnunet/src/namestore/plugin_namestore_sqlite.c
   gnunet/src/namestore/test_namestore_api.c
   gnunet/src/namestore/test_namestore_api_create.c
   gnunet/src/namestore/test_namestore_api_create_update.c
   gnunet/src/namestore/test_namestore_api_lookup.c
   gnunet/src/namestore/test_namestore_api_lookup_specific_type.c
   gnunet/src/namestore/test_namestore_api_remove.c
   gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
   gnunet/src/namestore/test_namestore_api_zone_to_name.c
   gnunet/src/namestore/test_plugin_namestore.c
Log:
- usage of short hashes


Modified: gnunet/src/namestore/gnunet-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-namestore.c     2012-03-19 17:09:03 UTC (rev 
20610)
+++ gnunet/src/namestore/gnunet-namestore.c     2012-03-19 17:11:46 UTC (rev 
20611)
@@ -41,7 +41,7 @@
 /**
  * Hash of the public key of our zone.
  */
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
 
 /**
  * Private key for the our zone.
@@ -292,7 +292,7 @@
   }
   GNUNET_CRYPTO_rsa_key_get_public (zone_pkey,
                                    &pub);
-  GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone);
+  GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &zone);
 
   ns = GNUNET_NAMESTORE_connect (cfg);
   if (NULL == ns)

Modified: gnunet/src/namestore/gnunet-service-namestore.c
===================================================================
--- gnunet/src/namestore/gnunet-service-namestore.c     2012-03-19 17:09:03 UTC 
(rev 20610)
+++ gnunet/src/namestore/gnunet-service-namestore.c     2012-03-19 17:11:46 UTC 
(rev 20611)
@@ -45,7 +45,7 @@
 
   int has_zone;
 
-  GNUNET_HashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
 
   uint64_t request_id;
   uint32_t offset;
@@ -73,7 +73,7 @@
 {
   char * filename;
 
-  GNUNET_HashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
   struct GNUNET_CRYPTO_RsaPrivateKey *privkey;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey;
 };
@@ -125,7 +125,7 @@
 
   if (GNUNET_YES == GNUNET_DISK_file_test (filename))
   {
-    GNUNET_HashCode zone;
+    struct GNUNET_CRYPTO_ShortHashCode zone;
     struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
     struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 
@@ -133,24 +133,24 @@
     if (privkey == NULL)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-           _("File zone `%s' but corrupt content already exists, failed to 
write! \n"), GNUNET_h2s (&zone));
+           _("File zone `%s' but corrupt content already exists, failed to 
write! \n"), GNUNET_short_h2s (&zone));
       return GNUNET_SYSERR;
     }
 
-    GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
-    GNUNET_CRYPTO_hash(&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
-    GNUNET_CRYPTO_rsa_key_free(privkey);
+    GNUNET_CRYPTO_rsa_key_get_public (privkey, &pubkey);
+    GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
+    GNUNET_CRYPTO_rsa_key_free (privkey);
 
     if (0 == memcmp (&zone, &c->zone, sizeof(zone)))
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
-           _("File zone `%s' containing this key already exists\n"), 
GNUNET_h2s (&zone));
+           _("File zone `%s' containing this key already exists\n"), 
GNUNET_short_h2s (&zone));
       return GNUNET_OK;
     }
     else
     {
       GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-           _("File zone `%s' but different zone key already exists, failed to 
write! \n"), GNUNET_h2s (&zone));
+           _("File zone `%s' but different zone key already exists, failed to 
write! \n"), GNUNET_short_h2s (&zone));
       return GNUNET_OK;
     }
   }
@@ -185,12 +185,12 @@
   GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-       _("Stored zonekey for zone `%s' in file `%s'\n"), GNUNET_h2s(&c->zone), 
c->filename);
+       _("Stored zonekey for zone `%s' in file `%s'\n"), 
GNUNET_short_h2s(&c->zone), c->filename);
   return GNUNET_OK;
 }
 
 int zone_to_disk_it (void *cls,
-                     const GNUNET_HashCode * key,
+                     const GNUNET_HashCode *key,
                      void *value)
 {
   struct GNUNET_NAMESTORE_CryptoContainer * c = value;
@@ -199,11 +199,12 @@
     write_key_to_file(c->filename, c);
   else
   {
-    GNUNET_asprintf(&c->filename, "%s/%s.zkey", zonefile_directory, 
GNUNET_h2s_full (&c->zone));
+    GNUNET_asprintf(&c->filename, "%s/%s.zkey", zonefile_directory, 
GNUNET_short_h2s (&c->zone));
     write_key_to_file(c->filename, c);
   }
 
-  GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value);;
+
+  GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value);
   GNUNET_CRYPTO_rsa_key_free(c->privkey);
   GNUNET_free (c->pubkey);
   GNUNET_free(c->filename);
@@ -340,7 +341,7 @@
   struct GNUNET_NAMESTORE_Client *nc;
   uint32_t request_id;
   uint32_t record_type;
-  GNUNET_HashCode *zone;
+  struct GNUNET_CRYPTO_ShortHashCode *zone;
   char * name;
 };
 
@@ -352,12 +353,12 @@
                    const struct GNUNET_NAMESTORE_RecordData *rd,
                    const struct GNUNET_CRYPTO_RsaSignature *signature)
 {
-  GNUNET_HashCode zone_hash;
+  struct GNUNET_CRYPTO_ShortHashCode zone_hash;
   int * stop = cls;
   if (NULL != zone_key)
   {
-    GNUNET_CRYPTO_hash(zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting zone `%s'\n", GNUNET_h2s 
(&zone_hash));
+    GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting zone `%s'\n", 
GNUNET_short_h2s (&zone_hash));
     GSN_database->delete_zone (GSN_database->cls, &zone_hash);
   }
   else
@@ -383,7 +384,8 @@
   struct GNUNET_NAMESTORE_CryptoContainer *cc;
   struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
   struct GNUNET_TIME_Absolute e;
-  GNUNET_HashCode zone_key_hash;
+  struct GNUNET_CRYPTO_ShortHashCode zone_key_hash;
+  GNUNET_HashCode long_hash;
   char *rd_tmp;
   char *name_tmp;
   size_t rd_ser_len;
@@ -408,7 +410,7 @@
         if (rd[c].record_type == lnc->record_type)
           copied_elements++; /* found matching record */
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records with type %u for 
name `%s' in zone `%s'\n",
-          copied_elements, lnc->record_type, lnc->name, GNUNET_h2s(lnc->zone));
+          copied_elements, lnc->record_type, lnc->name, 
GNUNET_short_h2s(lnc->zone));
       rd_selected = GNUNET_malloc (copied_elements * sizeof (struct 
GNUNET_NAMESTORE_RecordData));
       copied_elements = 0;
       for (c = 0; c < rd_count; c ++)
@@ -440,7 +442,7 @@
   GNUNET_NAMESTORE_records_serialize(copied_elements, rd_selected, rd_ser_len, 
rd_ser);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records for name `%s' in zone 
`%s'\n",
-      copied_elements, lnc->name, GNUNET_h2s(lnc->zone));
+      copied_elements, lnc->name, GNUNET_short_h2s(lnc->zone));
 
   if ((copied_elements == rd_count) && (NULL != signature))
     contains_signature = GNUNET_YES; /* returning all records, so include 
signature */
@@ -450,18 +452,19 @@
 
   if ((NULL != zone_key) && (copied_elements == rd_count))
   {
-    GNUNET_CRYPTO_hash(zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
-    if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &zone_key_hash))
+    GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
+    GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash);
+    if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash))
     {
-      cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &zone_key_hash);
+      cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash);
       e = get_block_expiration_time(rd_count, rd);
       signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, 
rd, rd_count);
       GNUNET_assert (signature_new != NULL);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for name `%s' 
with %u records in zone `%s'\n",name, copied_elements, 
GNUNET_h2s(&zone_key_hash));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for name `%s' 
with %u records in zone `%s'\n",name, copied_elements, 
GNUNET_short_h2s(&zone_key_hash));
       authoritative = GNUNET_YES;
     }
     else
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am not authoritative for name 
`%s' in zone `%s'\n",name, GNUNET_h2s(&zone_key_hash));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am not authoritative for name 
`%s' in zone `%s'\n",name, GNUNET_short_h2s(&zone_key_hash));
   }
 
   r_size = sizeof (struct LookupNameResponseMessage) +
@@ -565,9 +568,9 @@
   }
 
   if (0 == type)
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' 
in zone `%s'\n", name, GNUNET_h2s(&ln_msg->zone));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' 
in zone `%s'\n", name, GNUNET_short_h2s(&ln_msg->zone));
   else
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for 
name `%s' in zone `%s'\n", type, name, GNUNET_h2s(&ln_msg->zone));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for 
name `%s' in zone `%s'\n", type, name, GNUNET_short_h2s(&ln_msg->zone));
 
   /* do the actual lookup */
   lnc.request_id = rid;
@@ -672,10 +675,10 @@
     goto send;
   }
 
-  GNUNET_HashCode zone_hash;
-  GNUNET_CRYPTO_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), 
&zone_hash);
+  struct GNUNET_CRYPTO_ShortHashCode zone_hash;
+  GNUNET_CRYPTO_short_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), 
&zone_hash);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting %u record for name `%s' in 
zone `%s'\n", rd_count, name, GNUNET_h2s(&zone_hash));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting %u record for name `%s' in 
zone `%s'\n", rd_count, name, GNUNET_short_h2s(&zone_hash));
 
   /* Database operation */
   res = GSN_database->put_records(GSN_database->cls,
@@ -836,7 +839,8 @@
   struct GNUNET_CRYPTO_RsaPrivateKey *pkey;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
   struct RecordCreateResponseMessage rcr_msg;
-  GNUNET_HashCode pubkey_hash;
+  struct GNUNET_CRYPTO_ShortHashCode pubkey_hash;
+  GNUNET_HashCode long_hash;
   size_t name_len;
   size_t msg_size;
   size_t msg_size_exp;
@@ -914,19 +918,19 @@
   pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
   GNUNET_assert (pkey != NULL);
   GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub);
-  GNUNET_CRYPTO_hash (&pub, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+  GNUNET_CRYPTO_short_hash (&pub, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+  GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash);
 
-  if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, 
&pubkey_hash))
+  if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, 
&long_hash))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone 
`%s'\n",GNUNET_h2s(&pubkey_hash));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone 
`%s'\n",GNUNET_short_h2s(&pubkey_hash));
 
     cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer));
     cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
     cc->pubkey = GNUNET_malloc(sizeof (pub));
     memcpy (cc->pubkey, &pub, sizeof(pub));
     cc->zone = pubkey_hash;
-
-    GNUNET_CONTAINER_multihashmap_put(zonekeys, &pubkey_hash, cc, 
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+    GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, cc, 
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
   }
 
   crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire);
@@ -936,7 +940,7 @@
   crc.rd = rd;
   crc.name = name_tmp;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating record for name `%s' in zone 
`%s'\n", name_tmp, GNUNET_h2s(&pubkey_hash));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating record for name `%s' in zone 
`%s'\n", name_tmp, GNUNET_short_h2s(&pubkey_hash));
 
   /* Get existing records for name */
   res = GSN_database->iterate_records(GSN_database->cls, &pubkey_hash, 
name_tmp, 0, &handle_create_record_it, &crc);
@@ -1064,7 +1068,8 @@
   struct GNUNET_CRYPTO_RsaPrivateKey *pkey;
   struct GNUNET_NAMESTORE_CryptoContainer *cc = NULL;
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
-  GNUNET_HashCode pubkey_hash;
+  struct GNUNET_CRYPTO_ShortHashCode pubkey_hash;
+  GNUNET_HashCode long_hash;
   char * pkey_tmp = NULL;
   char * name_tmp = NULL;
   char * rd_ser = NULL;
@@ -1154,18 +1159,19 @@
   pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
   GNUNET_assert (pkey != NULL);
   GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub);
-  GNUNET_CRYPTO_hash (&pub, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+  GNUNET_CRYPTO_short_hash (&pub, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+  GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash);
 
-  if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, 
&pubkey_hash))
+  if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, 
&long_hash))
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone 
`%s'\n",GNUNET_h2s(&pubkey_hash));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone 
`%s'\n",GNUNET_short_h2s(&pubkey_hash));
     cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer));
     cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
     cc->pubkey = GNUNET_malloc(sizeof (pub));
     memcpy (cc->pubkey, &pub, sizeof(pub));
     cc->zone = pubkey_hash;
 
-    GNUNET_CONTAINER_multihashmap_put(zonekeys, &pubkey_hash, cc, 
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+    GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, cc, 
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
   }
 
   struct GNUNET_NAMESTORE_RecordData rd[rd_count];
@@ -1180,7 +1186,7 @@
   rrc.rd = rd;
   rrc.pkey = pkey;
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing record for name `%s' in zone 
`%s'\n", name_tmp, GNUNET_h2s(&pubkey_hash));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing record for name `%s' in zone 
`%s'\n", name_tmp, GNUNET_short_h2s(&pubkey_hash));
 
   /* Database operation */
   res = GSN_database->iterate_records (GSN_database->cls,
@@ -1342,10 +1348,10 @@
   ztn_ctx.rid = rid;
   ztn_ctx.nc = nc;
 
-  char * z_tmp = strdup (GNUNET_h2s (&ztn_msg->zone));
+  char * z_tmp = strdup (GNUNET_short_h2s (&ztn_msg->zone));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up name for zone `%s' in zone 
`%s'\n",
       z_tmp,
-      GNUNET_h2s (&ztn_msg->value_zone));
+      GNUNET_short_h2s (&ztn_msg->value_zone));
   GNUNET_free (z_tmp);
 
   GSN_database->zone_to_name (GSN_database->cls, &ztn_msg->zone, 
&ztn_msg->value_zone, &handle_zone_to_name_it, &ztn_ctx);
@@ -1383,14 +1389,15 @@
   struct GNUNET_NAMESTORE_CryptoContainer * cc;
   struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
   struct GNUNET_TIME_Absolute e;
-  GNUNET_HashCode zone_key_hash;
+  struct GNUNET_CRYPTO_ShortHashCode zone_key_hash;
+  GNUNET_HashCode long_hash;
   int authoritative = GNUNET_NO;
 
   if ((zone_key == NULL) && (name == NULL))
   {
     struct ZoneIterationResponseMessage zir_msg;
     if (zi->has_zone == GNUNET_YES)
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", 
GNUNET_h2s(&zi->zone));
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", 
GNUNET_short_h2s(&zi->zone));
     else
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for all zones\n");
 
@@ -1417,7 +1424,7 @@
     struct ZoneIterationResponseMessage *zir_msg;
     if (zi->has_zone == GNUNET_YES)
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration 
over zone `%s'\n",
-          name, GNUNET_h2s(&zi->zone));
+          name, GNUNET_short_h2s(&zi->zone));
     if (zi->has_zone == GNUNET_NO)
       GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration 
over all zones\n",
           name);
@@ -1438,15 +1445,16 @@
     name_tmp = (char *) &zir_msg[1];
     rd_tmp = &name_tmp[name_len];
 
-    GNUNET_CRYPTO_hash(zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
-    if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &zone_key_hash))
+    GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
+    GNUNET_CRYPTO_short_hash_double(&zone_key_hash, &long_hash);
+    if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash))
     {
-      cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &zone_key_hash);
+      cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash);
       e = get_block_expiration_time(rd_count, rd);
       expire = e;
       signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, 
rd, rd_count);
       GNUNET_assert (signature_new != NULL);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for `%s' in 
zone `%s' with %u records  and expiration %llu\n", name, 
GNUNET_h2s(&zone_key_hash), rd_count, e.abs_value);
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for `%s' in 
zone `%s' with %u records  and expiration %llu\n", name, 
GNUNET_short_h2s(&zone_key_hash), rd_count, e.abs_value);
       authoritative = GNUNET_YES;
     }
 
@@ -1502,8 +1510,8 @@
   zi->client = nc;
   zi->zone = zis_msg->zone;
 
-  GNUNET_HashCode dummy;
-  GNUNET_HashCode *zone_tmp;
+  struct GNUNET_CRYPTO_ShortHashCode dummy;
+  struct GNUNET_CRYPTO_ShortHashCode *zone_tmp;
   memset (&dummy, '\0', sizeof (dummy));
   if (0 == memcmp (&dummy, &zis_msg->zone, sizeof (dummy)))
   {
@@ -1513,7 +1521,7 @@
   }
   else
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over zone  
`%s'\n", GNUNET_h2s (&zis_msg->zone));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over zone  
`%s'\n", GNUNET_short_h2s (&zis_msg->zone));
     zi->has_zone = GNUNET_YES;
     zone_tmp = &zis_msg->zone;
   }
@@ -1558,7 +1566,7 @@
 
   GNUNET_CONTAINER_DLL_remove(nc->op_head, nc->op_tail, zi);
   if (GNUNET_YES == zi->has_zone)
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone 
`%s'\n", GNUNET_h2s (&zi->zone));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone 
`%s'\n", GNUNET_short_h2s (&zi->zone));
   else
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration all zones\n");
   GNUNET_free (zi);
@@ -1574,7 +1582,7 @@
 
   struct GNUNET_NAMESTORE_Client *nc;
   struct GNUNET_NAMESTORE_ZoneIteration *zi;
-  GNUNET_HashCode *zone_tmp;
+  struct GNUNET_CRYPTO_ShortHashCode *zone_tmp;
   struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage 
*) message;
   uint32_t rid;
 
@@ -1611,6 +1619,7 @@
 
 int zonekey_file_it (void *cls, const char *filename)
 {
+  GNUNET_HashCode long_hash;
   int *counter = cls;
    if ((filename != NULL) && (NULL != strstr(filename, ".zkey")))
    {
@@ -1624,11 +1633,12 @@
      c->pubkey = GNUNET_malloc(sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
      c->privkey = privkey;
      GNUNET_CRYPTO_rsa_key_get_public(privkey, c->pubkey);
-     GNUNET_CRYPTO_hash(c->pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &c->zone);
+     GNUNET_CRYPTO_short_hash(c->pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &c->zone);
 
-     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found zonefile for zone `%s'\n", 
GNUNET_h2s (&c->zone));
-
-     GNUNET_CONTAINER_multihashmap_put(zonekeys, &c->zone, c, 
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+     //GNUNET_CRYPTO_short_hash_to_enc (&name_hase, &name_enc);
+     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found zonefile for zone `%s'\n", 
GNUNET_short_h2s (&c->zone));
+     GNUNET_CRYPTO_short_hash_double (&c->zone, &long_hash);
+     GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, c, 
GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
      (*counter) ++;
    }
    return GNUNET_OK;

Modified: gnunet/src/namestore/namestore.h
===================================================================
--- gnunet/src/namestore/namestore.h    2012-03-19 17:09:03 UTC (rev 20610)
+++ gnunet/src/namestore/namestore.h    2012-03-19 17:11:46 UTC (rev 20611)
@@ -47,6 +47,17 @@
 #define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448
 
 /**
+ * Convert a short hash to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param hc the short hash code
+ * @return string form; will be overwritten by next call to GNUNET_h2s.
+ */
+const char *
+GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc);
+
+/**
  * Sign name and records
  *
  * @param key the private key
@@ -150,7 +161,7 @@
   /**
    * The zone 
    */
-  GNUNET_HashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
 
   /**
    * Requested record type 
@@ -419,12 +430,12 @@
   /**
    * The hash of public key of the zone to look up in 
    */
-  GNUNET_HashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
 
   /**
    * The  hash of the public key of the target zone  
    */
-  GNUNET_HashCode value_zone;
+  struct GNUNET_CRYPTO_ShortHashCode value_zone;
 };
 
 /**
@@ -487,7 +498,7 @@
   /**
    * Zone hash
    */
-  GNUNET_HashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
 
   /**
    * Which flags must be included

Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c        2012-03-19 17:09:03 UTC (rev 
20610)
+++ gnunet/src/namestore/namestore_api.c        2012-03-19 17:11:46 UTC (rev 
20611)
@@ -90,7 +90,7 @@
   struct GNUNET_NAMESTORE_Handle *h;
   GNUNET_NAMESTORE_RecordProcessor proc;
   void* proc_cls;
-  GNUNET_HashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
   uint32_t no_flags;
   uint32_t flags;
   int has_zone;
@@ -193,7 +193,7 @@
   struct GNUNET_NAMESTORE_SimpleRecord *prev;
   
   const char *name;
-  const GNUNET_HashCode *zone;
+  const struct GNUNET_CRYPTO_ShortHashCode *zone;
   uint32_t record_type;
   struct GNUNET_TIME_Absolute expiration;
   enum GNUNET_NAMESTORE_RecordFlags flags;
@@ -1316,7 +1316,7 @@
  */
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h, 
-                             const GNUNET_HashCode *zone,
+                             const struct GNUNET_CRYPTO_ShortHashCode *zone,
                              const char *name,
                              uint32_t record_type,
                              GNUNET_NAMESTORE_RecordProcessor proc, void 
*proc_cls)
@@ -1388,8 +1388,8 @@
  */
 struct GNUNET_NAMESTORE_QueueEntry *
 GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
-                               const GNUNET_HashCode *zone,
-                               const GNUNET_HashCode *value_zone,
+                               const struct GNUNET_CRYPTO_ShortHashCode *zone,
+                               const struct GNUNET_CRYPTO_ShortHashCode 
*value_zone,
                                GNUNET_NAMESTORE_RecordProcessor proc, void 
*proc_cls)
 {
   struct GNUNET_NAMESTORE_QueueEntry *qe;
@@ -1424,11 +1424,11 @@
   msg->zone = *zone;
   msg->value_zone = *value_zone;
 
-  char * z_tmp = strdup (GNUNET_h2s (zone));
+  char * z_tmp = strdup (GNUNET_short_h2s (zone));
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s' in 
zone `%s'\n",
       "NAMESTORE_ZONE_TO_NAME",
       z_tmp,
-      GNUNET_h2s (value_zone));
+      GNUNET_short_h2s (value_zone));
   GNUNET_free (z_tmp);
 
   /* transmit message */
@@ -1460,7 +1460,7 @@
  */
 struct GNUNET_NAMESTORE_ZoneIterator *
 GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
-                                      const GNUNET_HashCode *zone,
+                                      const struct GNUNET_CRYPTO_ShortHashCode 
*zone,
                                       enum GNUNET_NAMESTORE_RecordFlags 
must_have_flags,
                                       enum GNUNET_NAMESTORE_RecordFlags 
must_not_have_flags,
                                       GNUNET_NAMESTORE_RecordProcessor proc,
@@ -1507,7 +1507,7 @@
   msg->gns_header.r_id = htonl (rid);
   if (NULL != zone)
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone 
`%s'\n", "ZONE_ITERATION_START", GNUNET_h2s(zone));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone 
`%s'\n", "ZONE_ITERATION_START", GNUNET_short_h2s(zone));
     msg->zone = *zone;
   }
   else
@@ -1610,7 +1610,7 @@
   msg->gns_header.r_id = htonl (it->op_id);
 
   if (GNUNET_YES == it->has_zone)
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone 
`%s'\n", "ZONE_ITERATION_STOP", GNUNET_h2s(&it->zone));
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone 
`%s'\n", "ZONE_ITERATION_STOP", GNUNET_short_h2s(&it->zone));
   else
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for all 
zones\n", "ZONE_ITERATION_STOP");
 

Modified: gnunet/src/namestore/namestore_common.c
===================================================================
--- gnunet/src/namestore/namestore_common.c     2012-03-19 17:09:03 UTC (rev 
20610)
+++ gnunet/src/namestore/namestore_common.c     2012-03-19 17:11:46 UTC (rev 
20611)
@@ -66,7 +66,26 @@
   
 };
 
+
 /**
+ * Convert a short hash to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param hc the short hash code
+ * @return string form; will be overwritten by next call to GNUNET_h2s.
+ */
+const char *
+GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc)
+{
+  static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret;
+
+  GNUNET_CRYPTO_short_hash_to_enc (hc, &ret);
+  return (const char *) &ret;
+}
+
+
+/**
  * Calculate how many bytes we will need to serialize the given
  * records.
  *

Modified: gnunet/src/namestore/plugin_namestore_sqlite.c
===================================================================
--- gnunet/src/namestore/plugin_namestore_sqlite.c      2012-03-19 17:09:03 UTC 
(rev 20610)
+++ gnunet/src/namestore/plugin_namestore_sqlite.c      2012-03-19 17:11:46 UTC 
(rev 20611)
@@ -397,19 +397,18 @@
  */
 static int 
 namestore_sqlite_remove_records (void *cls, 
-                                const GNUNET_HashCode *zone,
+                                const struct GNUNET_CRYPTO_ShortHashCode *zone,
                                 const char *name)
 {
   struct Plugin *plugin = cls;
-  GNUNET_HashCode nh;
+  struct GNUNET_CRYPTO_ShortHashCode nh;
   size_t name_len;
   int n;
-
   name_len = strlen (name);
-  GNUNET_CRYPTO_hash (name, name_len, &nh);
+  GNUNET_CRYPTO_short_hash (name, name_len, &nh);
 
-  if ((SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 1, zone, sizeof 
(GNUNET_HashCode), SQLITE_STATIC)) ||
-      (SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 2, &nh, sizeof 
(GNUNET_HashCode), SQLITE_STATIC)))
+  if ((SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 1, zone, sizeof 
(struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) ||
+      (SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 2, &nh, sizeof 
(struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)))
   {
     LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
                 "sqlite3_bind_XXXX");
@@ -466,26 +465,26 @@
 {
   struct Plugin *plugin = cls;
   int n;
-  GNUNET_HashCode zone;
-  GNUNET_HashCode zone_delegation;
-  GNUNET_HashCode nh;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone_delegation;
+  struct GNUNET_CRYPTO_ShortHashCode nh;
   size_t name_len;
   uint64_t rvalue;
   size_t data_size;
   unsigned int i;
 
-  GNUNET_CRYPTO_hash (zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
+  GNUNET_CRYPTO_short_hash (zone_key, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
   (void) namestore_sqlite_remove_records (plugin, &zone, name);
   name_len = strlen (name);
-  GNUNET_CRYPTO_hash (name, name_len, &nh);
+  GNUNET_CRYPTO_short_hash (name, name_len, &nh);
   memset (&zone_delegation, 0, sizeof (zone_delegation));
   for (i=0;i<rd_count;i++)
     if (rd[i].record_type == GNUNET_NAMESTORE_TYPE_PKEY)
     {
-      GNUNET_assert (sizeof (GNUNET_HashCode) == rd[i].data_size);
+      GNUNET_assert (sizeof (struct GNUNET_CRYPTO_ShortHashCode) == 
rd[i].data_size);
       memcpy (&zone_delegation,
              rd[i].data,
-             sizeof (GNUNET_HashCode));
+             sizeof (struct GNUNET_CRYPTO_ShortHashCode));
       break;
     }
   rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
@@ -510,9 +509,9 @@
        (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 4, data, 
data_size, SQLITE_STATIC)) ||
        (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 5, 
expire.abs_value)) ||
        (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 6, signature, 
sizeof (struct GNUNET_CRYPTO_RsaSignature), SQLITE_STATIC)) ||
-       (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, 
&zone_delegation, sizeof (GNUNET_HashCode), SQLITE_STATIC)) ||
-       (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof 
(GNUNET_HashCode), SQLITE_STATIC)) ||
-       (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 9, &nh, sizeof 
(GNUNET_HashCode), SQLITE_STATIC)) ||
+       (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, 
&zone_delegation, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) 
||
+       (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof 
(struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) ||
+       (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 9, &nh, sizeof 
(struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) ||
        (SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 10, rvalue)) )
     {
       LOG_SQLITE (plugin, 
@@ -638,14 +637,14 @@
  */
 static int 
 namestore_sqlite_iterate_records (void *cls, 
-                                 const GNUNET_HashCode *zone,
+                                 const struct GNUNET_CRYPTO_ShortHashCode 
*zone,
                                  const char *name,
                                  uint64_t offset,
                                  GNUNET_NAMESTORE_RecordIterator iter, void 
*iter_cls)
 {
   struct Plugin *plugin = cls;
   sqlite3_stmt *stmt;
-  GNUNET_HashCode name_hase;
+  struct GNUNET_CRYPTO_ShortHashCode name_hase;
   unsigned int boff;
 
   if (NULL == zone)
@@ -653,7 +652,7 @@
       stmt = plugin->iterate_all;
     else
     {
-      GNUNET_CRYPTO_hash (name, strlen(name), &name_hase);
+      GNUNET_CRYPTO_short_hash (name, strlen(name), &name_hase);
       stmt = plugin->iterate_by_name;
     }
   else
@@ -661,14 +660,14 @@
       stmt = plugin->iterate_by_zone;
     else
     {
-      GNUNET_CRYPTO_hash (name, strlen(name), &name_hase);
+      GNUNET_CRYPTO_short_hash (name, strlen(name), &name_hase);
       stmt = plugin->iterate_records;
     }
 
   boff = 0;
   if ( (NULL != zone) &&
        (SQLITE_OK != sqlite3_bind_blob (stmt, ++boff, 
-                                       zone, sizeof (GNUNET_HashCode), 
+                                       zone, sizeof (struct 
GNUNET_CRYPTO_ShortHashCode),
                                        SQLITE_STATIC)) )
   {
     LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
@@ -681,10 +680,10 @@
   }      
   if ( (NULL != name) &&
        (SQLITE_OK != sqlite3_bind_blob (stmt, ++boff, 
-                                       &name_hase, sizeof (GNUNET_HashCode),
+                                       &name_hase, sizeof (struct 
GNUNET_CRYPTO_ShortHashCode),
                                        SQLITE_STATIC)) )
   {
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ITERATE NAME HASH: `%s'", 
GNUNET_h2s_full(&name_hase));
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ITERATE NAME HASH: `%8s'", 
GNUNET_short_h2s(&name_hase));
     LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
                "sqlite3_bind_XXXX");
     if (SQLITE_OK != sqlite3_reset (stmt))
@@ -723,8 +722,8 @@
  */
 static int
 namestore_sqlite_zone_to_name (void *cls, 
-                              const GNUNET_HashCode *zone,
-                              const GNUNET_HashCode *value_zone,
+                              const struct GNUNET_CRYPTO_ShortHashCode *zone,
+                              const struct GNUNET_CRYPTO_ShortHashCode 
*value_zone,
                               GNUNET_NAMESTORE_RecordIterator iter, void 
*iter_cls)
 {
   struct Plugin *plugin = cls;
@@ -732,10 +731,10 @@
 
   stmt = plugin->zone_to_name;
   if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, 
-                                       zone, sizeof (GNUNET_HashCode), 
+                                       zone, sizeof (struct 
GNUNET_CRYPTO_ShortHashCode),
                                        SQLITE_STATIC)) ||
        (SQLITE_OK != sqlite3_bind_blob (stmt, 2, 
-                                       value_zone, sizeof (GNUNET_HashCode), 
+                                       value_zone, sizeof (struct 
GNUNET_CRYPTO_ShortHashCode),
                                        SQLITE_STATIC)) )
   {
     LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
@@ -759,13 +758,13 @@
  */
 static void 
 namestore_sqlite_delete_zone (void *cls,
-                             const GNUNET_HashCode *zone)
+                             const struct GNUNET_CRYPTO_ShortHashCode *zone)
 {
   struct Plugin *plugin = cls;
   sqlite3_stmt *stmt = plugin->delete_zone;
   int n;
 
-  if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (GNUNET_HashCode), 
SQLITE_STATIC))
+  if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (struct 
GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC))
   {
     LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
                 "sqlite3_bind_XXXX");

Modified: gnunet/src/namestore/test_namestore_api.c
===================================================================
--- gnunet/src/namestore/test_namestore_api.c   2012-03-19 17:09:03 UTC (rev 
20610)
+++ gnunet/src/namestore/test_namestore_api.c   2012-03-19 17:11:46 UTC (rev 
20611)
@@ -36,7 +36,7 @@
 
 static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
 
 static int res;
 
@@ -175,7 +175,7 @@
   GNUNET_assert (privkey != NULL);
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
 
-  GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &zone);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone);
 
 
   struct GNUNET_CRYPTO_RsaSignature signature;

Modified: gnunet/src/namestore/test_namestore_api_create.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_create.c    2012-03-19 17:09:03 UTC 
(rev 20610)
+++ gnunet/src/namestore/test_namestore_api_create.c    2012-03-19 17:11:46 UTC 
(rev 20611)
@@ -49,7 +49,7 @@
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 struct GNUNET_CRYPTO_RsaSignature *s_signature;
 struct GNUNET_CRYPTO_RsaSignature *s_signature_updated;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
 struct GNUNET_NAMESTORE_RecordData *s_first_record;
 struct GNUNET_NAMESTORE_RecordData *s_second_record;
 static char *s_name;
@@ -426,9 +426,9 @@
   s_signature = GNUNET_NAMESTORE_create_signature(privkey, 
s_first_record->expiration, s_name, s_first_record, 1);
 
   /* create random zone hash */
-  GNUNET_CRYPTO_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, 
GNUNET_h2s_full(&s_zone));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, 
GNUNET_short_h2s (&s_zone));
 
   start_arm (cfgfile);
   GNUNET_assert (arm != NULL);

Modified: gnunet/src/namestore/test_namestore_api_create_update.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_create_update.c     2012-03-19 
17:09:03 UTC (rev 20610)
+++ gnunet/src/namestore/test_namestore_api_create_update.c     2012-03-19 
17:11:46 UTC (rev 20611)
@@ -49,7 +49,7 @@
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 struct GNUNET_CRYPTO_RsaSignature *s_signature;
 struct GNUNET_CRYPTO_RsaSignature *s_signature_updated;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
 struct GNUNET_NAMESTORE_RecordData *s_first_record;
 struct GNUNET_NAMESTORE_RecordData *s_second_record;
 static char *s_name;
@@ -465,9 +465,9 @@
   s_signature = GNUNET_NAMESTORE_create_signature(privkey, 
s_first_record->expiration, s_name, s_first_record, 1);
 
   /* create random zone hash */
-  GNUNET_CRYPTO_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, 
GNUNET_h2s_full(&s_zone));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, 
GNUNET_short_h2s (&s_zone));
 
   start_arm (cfgfile);
   GNUNET_assert (arm != NULL);

Modified: gnunet/src/namestore/test_namestore_api_lookup.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_lookup.c    2012-03-19 17:09:03 UTC 
(rev 20610)
+++ gnunet/src/namestore/test_namestore_api_lookup.c    2012-03-19 17:11:46 UTC 
(rev 20611)
@@ -44,7 +44,7 @@
 static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
 struct GNUNET_NAMESTORE_RecordData *s_rd;
 static char *s_name;
 
@@ -273,7 +273,7 @@
   s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, 
s_name, s_rd, RECORDS);
 
   /* create random zone hash */
-  GNUNET_CRYPTO_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
 
   start_arm (cfgfile);
   GNUNET_assert (arm != NULL);

Modified: gnunet/src/namestore/test_namestore_api_lookup_specific_type.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_lookup_specific_type.c      
2012-03-19 17:09:03 UTC (rev 20610)
+++ gnunet/src/namestore/test_namestore_api_lookup_specific_type.c      
2012-03-19 17:11:46 UTC (rev 20611)
@@ -47,7 +47,7 @@
 static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
 struct GNUNET_NAMESTORE_RecordData *s_rd;
 static char *s_name;
 
@@ -345,7 +345,7 @@
   s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[RECORDS 
-1].expiration, s_name, s_rd, RECORDS);
 
   /* create random zone hash */
-  GNUNET_CRYPTO_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
 
   start_arm (cfgfile);
   GNUNET_assert (arm != NULL);

Modified: gnunet/src/namestore/test_namestore_api_remove.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_remove.c    2012-03-19 17:09:03 UTC 
(rev 20610)
+++ gnunet/src/namestore/test_namestore_api_remove.c    2012-03-19 17:11:46 UTC 
(rev 20611)
@@ -48,7 +48,7 @@
 static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
 struct GNUNET_NAMESTORE_RecordData *s_rd;
 static char *s_name;
 
@@ -309,9 +309,9 @@
   s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, 
s_name, s_rd, RECORDS);
 
   /* create random zone hash */
-  GNUNET_CRYPTO_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
 
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, 
GNUNET_h2s_full(&s_zone));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, 
GNUNET_short_h2s (&s_zone));
 
 
   start_arm (cfgfile);

Modified: gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c      
2012-03-19 17:09:03 UTC (rev 20610)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c      
2012-03-19 17:11:46 UTC (rev 20611)
@@ -38,11 +38,11 @@
 
 static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
 
 static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2;
-static GNUNET_HashCode zone2;
+static struct GNUNET_CRYPTO_ShortHashCode zone2;
 
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 static int res;
@@ -206,7 +206,7 @@
                 const struct GNUNET_CRYPTO_RsaSignature *signature)
 {
   int failed = GNUNET_NO;
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_h2s 
(&zone));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", 
GNUNET_short_h2s (&zone));
   if ((zone_key == NULL) &&  (name == NULL))
   {
     GNUNET_break (2 == returned_records);
@@ -326,7 +326,7 @@
     res = 1;
     returned_records = 0;
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All records created, starting 
iteration over zone `%s'\n",
-        GNUNET_h2s(&zone));
+        GNUNET_short_h2s(&zone));
     zi = GNUNET_NAMESTORE_zone_iteration_start(nsh,
                                         &zone,
                                         GNUNET_NAMESTORE_RF_NONE,
@@ -375,7 +375,7 @@
   GNUNET_free (hostkey_file);
   GNUNET_assert (privkey != NULL);
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
-  GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone);
 
   GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, 
"KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zkey");
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", 
hostkey_file);
@@ -383,7 +383,7 @@
   GNUNET_free (hostkey_file);
   GNUNET_assert (privkey2 != NULL);
   GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
-  GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
+  GNUNET_CRYPTO_short_hash (&pubkey2, sizeof (pubkey), &zone2);
 
 
   start_arm (cfgfile);

Modified: gnunet/src/namestore/test_namestore_api_zone_to_name.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_to_name.c      2012-03-19 
17:09:03 UTC (rev 20610)
+++ gnunet/src/namestore/test_namestore_api_zone_to_name.c      2012-03-19 
17:11:46 UTC (rev 20611)
@@ -46,8 +46,8 @@
 
 struct GNUNET_TIME_Absolute expire;
 
-static GNUNET_HashCode s_zone;
-static GNUNET_HashCode s_zone_value;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone_value;
 
 char * s_name;
 
@@ -230,8 +230,8 @@
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
 
   /* zone hash */
-  GNUNET_CRYPTO_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
-  GNUNET_CRYPTO_hash (s_name, strlen (s_name) + 1, &s_zone_value);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct 
GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+  GNUNET_CRYPTO_short_hash (s_name, strlen (s_name) + 1, &s_zone_value);
 
   struct GNUNET_NAMESTORE_RecordData rd;
   rd.expiration = GNUNET_TIME_absolute_get();

Modified: gnunet/src/namestore/test_plugin_namestore.c
===================================================================
--- gnunet/src/namestore/test_plugin_namestore.c        2012-03-19 17:09:03 UTC 
(rev 20610)
+++ gnunet/src/namestore/test_plugin_namestore.c        2012-03-19 17:11:46 UTC 
(rev 20611)
@@ -176,7 +176,7 @@
 {
   struct GNUNET_NAMESTORE_PluginFunctions *nsp;  
   struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded zone_key;
-  GNUNET_HashCode zone;
+  struct GNUNET_CRYPTO_ShortHashCode zone;
   
   ok = 0;
   nsp = load_plugin (cfg);
@@ -187,13 +187,16 @@
             "Failed to initialize namestore.  Database likely not setup, 
skipping test.\n");
     return;
   }
+
   put_record (nsp, 1);
+
   get_record (nsp, 1);
 
   memset (&zone_key, 1, sizeof (zone_key));
-  GNUNET_CRYPTO_hash (&zone_key, sizeof (zone_key), &zone);  
+  GNUNET_CRYPTO_short_hash (&zone_key, sizeof (zone_key), &zone);
   nsp->delete_zone (nsp->cls, &zone);
   unload_plugin (nsp);
+
 }
 
 




reply via email to

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