diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-08-19 19:18:17 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-08-19 19:18:17 +0000 |
commit | 165d153298d75b64a6a426b534a435945690b436 (patch) | |
tree | 3c95f417ebda73a68b347ec5c8aa3e18d2262593 /src/include/gnunet_crypto_lib.h | |
parent | 6afb005da9165db3cd814864956f08e23828de63 (diff) | |
download | gnunet-165d153298d75b64a6a426b534a435945690b436.tar.gz gnunet-165d153298d75b64a6a426b534a435945690b436.zip |
-remove ShortHashCode from API, deprecate SList
Diffstat (limited to 'src/include/gnunet_crypto_lib.h')
-rw-r--r-- | src/include/gnunet_crypto_lib.h | 100 |
1 files changed, 0 insertions, 100 deletions
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index 73a3db382..7fb3d2ac9 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h | |||
@@ -96,15 +96,6 @@ struct GNUNET_CRYPTO_HashAsciiEncoded | |||
96 | }; | 96 | }; |
97 | 97 | ||
98 | 98 | ||
99 | /** | ||
100 | * @brief 0-terminated ASCII encoding of a struct GNUNET_CRYPTO_ShortHashCode. | ||
101 | */ | ||
102 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded | ||
103 | { | ||
104 | unsigned char short_encoding[53]; | ||
105 | }; | ||
106 | |||
107 | |||
108 | GNUNET_NETWORK_STRUCT_BEGIN | 99 | GNUNET_NETWORK_STRUCT_BEGIN |
109 | 100 | ||
110 | 101 | ||
@@ -406,19 +397,6 @@ GNUNET_CRYPTO_hash_to_enc (const struct GNUNET_HashCode * block, | |||
406 | 397 | ||
407 | /** | 398 | /** |
408 | * @ingroup hash | 399 | * @ingroup hash |
409 | * Convert short hash to ASCII encoding. | ||
410 | * | ||
411 | * @param block the hash code | ||
412 | * @param result where to store the encoding (struct GNUNET_CRYPTO_ShortHashAsciiEncoded can be | ||
413 | * safely cast to char*, a '\\0' termination is set). | ||
414 | */ | ||
415 | void | ||
416 | GNUNET_CRYPTO_short_hash_to_enc (const struct GNUNET_CRYPTO_ShortHashCode * block, | ||
417 | struct GNUNET_CRYPTO_ShortHashAsciiEncoded *result); | ||
418 | |||
419 | |||
420 | /** | ||
421 | * @ingroup hash | ||
422 | * Convert ASCII encoding back to a 'struct GNUNET_HashCode' | 400 | * Convert ASCII encoding back to a 'struct GNUNET_HashCode' |
423 | * | 401 | * |
424 | * @param enc the encoding | 402 | * @param enc the encoding |
@@ -433,20 +411,6 @@ GNUNET_CRYPTO_hash_from_string2 (const char *enc, size_t enclen, | |||
433 | 411 | ||
434 | /** | 412 | /** |
435 | * @ingroup hash | 413 | * @ingroup hash |
436 | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | ||
437 | * | ||
438 | * @param enc the encoding | ||
439 | * @param enclen number of characters in @a enc (without 0-terminator, which can be missing) | ||
440 | * @param result where to store the hash code | ||
441 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding | ||
442 | */ | ||
443 | int | ||
444 | GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, | ||
445 | struct GNUNET_CRYPTO_ShortHashCode * result); | ||
446 | |||
447 | |||
448 | /** | ||
449 | * @ingroup hash | ||
450 | * Convert ASCII encoding back to struct GNUNET_HashCode | 414 | * Convert ASCII encoding back to struct GNUNET_HashCode |
451 | * | 415 | * |
452 | * @param enc the encoding | 416 | * @param enc the encoding |
@@ -459,31 +423,6 @@ GNUNET_CRYPTO_short_hash_from_string2 (const char *enc, size_t enclen, | |||
459 | 423 | ||
460 | /** | 424 | /** |
461 | * @ingroup hash | 425 | * @ingroup hash |
462 | * Convert ASCII encoding back to a 'struct GNUNET_CRYPTO_ShortHash' | ||
463 | * | ||
464 | * @param enc the encoding | ||
465 | * @param result where to store the GNUNET_CRYPTO_ShortHash | ||
466 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding | ||
467 | */ | ||
468 | #define GNUNET_CRYPTO_short_hash_from_string(enc, result) \ | ||
469 | GNUNET_CRYPTO_short_hash_from_string2 (enc, strlen(enc), result) | ||
470 | |||
471 | |||
472 | /** | ||
473 | * @ingroup hash | ||
474 | * Compare function for ShortHashCodes, producing a total ordering | ||
475 | * of all hashcodes. | ||
476 | * | ||
477 | * @param h1 some hash code | ||
478 | * @param h2 some hash code | ||
479 | * @return 1 if h1 > h2, -1 if h1 < h2 and 0 if h1 == h2. | ||
480 | */ | ||
481 | int | ||
482 | GNUNET_CRYPTO_short_hash_cmp (const struct GNUNET_CRYPTO_ShortHashCode * h1, | ||
483 | const struct GNUNET_CRYPTO_ShortHashCode * h2); | ||
484 | |||
485 | /** | ||
486 | * @ingroup hash | ||
487 | * Compute the distance between 2 hashcodes. | 426 | * Compute the distance between 2 hashcodes. |
488 | * The computation must be fast, not involve | 427 | * The computation must be fast, not involve |
489 | * a.a or a.e (they're used elsewhere), and | 428 | * a.a or a.e (they're used elsewhere), and |
@@ -513,45 +452,6 @@ GNUNET_CRYPTO_hash (const void *block, size_t size, struct GNUNET_HashCode * ret | |||
513 | 452 | ||
514 | /** | 453 | /** |
515 | * @ingroup hash | 454 | * @ingroup hash |
516 | * Compute short (256-bit) hash of a given block. | ||
517 | * | ||
518 | * @param block the data to hash | ||
519 | * @param size size of the @a block | ||
520 | * @param ret pointer to where to write the hashcode | ||
521 | */ | ||
522 | void | ||
523 | GNUNET_CRYPTO_short_hash (const void *block, size_t size, | ||
524 | struct GNUNET_CRYPTO_ShortHashCode * ret); | ||
525 | |||
526 | |||
527 | /** | ||
528 | * @ingroup hash | ||
529 | * Double short (256-bit) hash to create a long hash. | ||
530 | * | ||
531 | * @param sh short hash to double | ||
532 | * @param dh where to store the (doubled) long hash (not really a hash) | ||
533 | */ | ||
534 | void | ||
535 | GNUNET_CRYPTO_short_hash_double (const struct GNUNET_CRYPTO_ShortHashCode *sh, | ||
536 | struct GNUNET_HashCode *dh); | ||
537 | |||
538 | |||
539 | /** | ||
540 | * @ingroup hash | ||
541 | * Truncate doubled short hash back to a short hash. | ||
542 | * | ||
543 | * @param dh doubled short hash to reduce again | ||
544 | * @param sh where to store the short hash | ||
545 | * @return GNUNET_OK on success, GNUNET_SYSERR if this was not a | ||
546 | * doubled short hash | ||
547 | */ | ||
548 | int | ||
549 | GNUNET_CRYPTO_short_hash_from_truncation (const struct GNUNET_HashCode *dh, | ||
550 | struct GNUNET_CRYPTO_ShortHashCode *sh); | ||
551 | |||
552 | |||
553 | /** | ||
554 | * @ingroup hash | ||
555 | * Calculate HMAC of a message (RFC 2104) | 455 | * Calculate HMAC of a message (RFC 2104) |
556 | * | 456 | * |
557 | * @param key secret key | 457 | * @param key secret key |