rehash_types.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* GNU Guix --- Functional package management for GNU
  2. Copyright © 2020 Maxime Devos <maxime.devos@student.kuleuven.be>
  3. This file is part of GNU Guix.
  4. GNU Guix is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or (at
  7. your option) any later version.
  8. GNU Guix is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. */
  14. #ifndef _GNUNET_REHASH_TYPES_H
  15. #define _GNUNET_REHASH_TYPES_H 1
  16. #include <gnunet/gnunet_common.h>
  17. GNUNET_NETWORK_STRUCT_BEGIN
  18. /* Needs to be hashed first */
  19. struct GNUNET_REHASH_Request {
  20. uint32_t key_type; /* network byte order */
  21. uint32_t value_type; /* network byte order */
  22. /* Followed by char[], length depending on key_type */
  23. };
  24. /* Answer: char[hash_lengths[value_type]].
  25. TODO: would encrypting the response with a key
  26. derived from the GNUNET_REHASH_Request make sense?
  27. (Otherwise peers can sniff for hashes on the network
  28. even if they don't know the hash in the first place.) */
  29. GNUNET_NETWORK_STRUCT_END
  30. enum GNUNET_REHASH_Hash_Type {
  31. /* Never used on the network, not a real hash type! */
  32. GNUNET_REHASH_HASH_NONE = 0,
  33. /* Found in guix/packages.scm */
  34. GNUNET_REHASH_HASH_SHA256 = 1,
  35. GNUNET_REHASH_HASH_SHA512 = 2,
  36. GNUNET_REHASH_HASH_SHA3_256 = 3,
  37. GNUNET_REHASH_HASH_SHA3_512 = 4,
  38. GNUNET_REHASH_HASH_BLAKE2S_256 = 5,
  39. /* A gnunet://fs/chk/... URI (regular file)
  40. Not formatted as a string, is in some binary format.
  41. (struct FileIdentifier) */
  42. GNUNET_REHASH_HASH_FS_REGULAR = 6,
  43. /* TODO: map nix archives to GNUnet directories */
  44. };
  45. #define GNUNET_REHASH_HASH_LAST GNUNET_REHASH_HASH_FS_REGULAR
  46. #endif