}
-
/* ***************** binary-ASCII encoding *************** */
+/* FIXME: should use GNUNET_STRINGS_data_to_string and strings_to_data below!!! */
+
/**
* Get the numeric value corresponding to a character.
*
* Convert ASCII encoding back to GNUNET_CRYPTO_hash
*
* @param enc the encoding
+ * @param enclen number of characters in 'enc' (without 0-terminator, which can be missing)
* @param result where to store the GNUNET_CRYPTO_hash code
* @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding
*/
int
-GNUNET_CRYPTO_hash_from_string (const char *enc, GNUNET_HashCode * result)
+GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen,
+ GNUNET_HashCode * result)
{
unsigned int rpos;
unsigned int wpos;
unsigned int vbit;
int ret;
- if (strlen (enc) != sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1)
+ if (enclen != sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) - 1)
return GNUNET_SYSERR;
vbit = 2; /* padding! */