1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- /* GNU Guix --- Functional package management for GNU
- Copyright © 2020 Maxime Devos <maxime.devos@student.kuleuven.be>
- This file is part of GNU Guix.
- GNU Guix is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or (at
- your option) any later version.
- GNU Guix is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
- /**
- * @brief Some hash manipulation
- * @author Maxime Devos
- */
- #ifndef GNUNET_REHASH_UTIL_H
- #define GNUNET_REHASH_UTIL_H
- #include "rehash_types.h"
- #ifdef __cplusplus
- extern "C"
- {
- #if 0
- }
- #endif
- #endif
- /**
- * Convert a given name of a hash to to our internal
- * representation.
- *
- * @param name human readable string (e.g. sha256), NUL-terminated
- * @return the hash type on success, #GNUNET_REHASH_HASH_NONE on error
- */
- enum GNUNET_REHASH_Hash_Type
- GNUNET_REHASH_parse_hashtype_string (const char *name);
- /**
- * How long is the string representation of the hash
- * type? (including terminating NUL byte)
- *
- * @param internal representation (#GNUNET_REHASH_HASH_NONE is invalid!)
- * @return the length on success (>0, <=32), 0 if not recognised
- */
- int
- GNUNET_REHASH_hashtype_strsize (enum GNUNET_REHASH_Hash_Type type);
- /**
- * Write a human readable representation of a hash type.
- *
- * If the output buffer is too small, only a partial write
- * is performed.
- *
- * @param type hash type to figure out a string of
- * @param size size of output buffer
- * @param outbuf location to write output, including terminating NUL byte
- * @return the size of the actual string (including NUL byte), or 0
- * if type is unrecognised
- */
- int
- GNUNET_REHASH_unparse_hashtype (enum GNUNET_REHASH_Hash_Type type, int size, char outbuf[]);
- #if 0
- {
- #endif
- #ifdef __cplusplus
- }
- #endif
- #endif
|