#ifndef SIGSUM_ASCII_H_INCLUDED
#define SIGSUM_ASCII_H_INCLUDED

#include <stdbool.h>

#include "crypto.h"

struct sigsum_error
{
  const char *msg;
  size_t line;
};

/* All the decoding functions returns true on success, false on
   failure. Hex decoding is case-insensitive. */

/* Input must be 64 hex digits. */
bool
sigsum_decode_hex_key (struct sigsum_pubkey *dst, const char *src);

/* Input must be 64 hex digits. */
bool
sigsum_decode_hex_hash (struct sigsum_hash *dst, const char *src);

/* Input must be 128 hex digits. */
bool
sigsum_decode_hex_signature (struct sigsum_signature *dst, const char *src);

/* Valid range 0 <= x < 2^63. Digits only, no leading zeros (except
   for just "0"). */
bool
sigsum_decode_decimal (sigsum_size_t *number, size_t size, const char *data);

#endif /* SIGSUM_ASCII_H_INCLUDED */
