if (i > 0)
GNUNET_CRYPTO_hash (&hc, sizeof (GNUNET_HashCode), &tmp);
+ fprintf (stderr, "H: %s\n", GNUNET_h2s (&tmp));
+
for (j=0;j<sizeof(GNUNET_HashCode) / sizeof(uint32_t); j++)
{
#if HAVE_GCRY_MPI_LSHIFT
return rc;
}
+/**
+ * If target != size, move target bytes to the
+ * end of the size-sized buffer and zero out the
+ * first target-size bytes.
+ */
+static void
+adjust (unsigned char *buf, size_t size, size_t target)
+{
+ if (size < target)
+ {
+ memmove (&buf[target - size], buf, size);
+ memset (buf, 0, target - size);
+ }
+}
+
+
static void
gen_prime (gcry_mpi_t *ptest, unsigned int nbits, GNUNET_HashCode * hc)
{
gcry_mpi_print (GCRYMPI_FMT_USG,
(unsigned char*) &mods[i], written, &written,
tmp));
+ adjust ( (unsigned char*) &mods[i], written, sizeof (unsigned int));
+ mods[i] = ntohl (mods[i]);
}
/* Now try some primes starting with prime. */
for (step = 0; step < 20000; step += 2)