You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

blake2.h 1.5KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /*-
  2. * Copyright 2016 Vsevolod Stakhov
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #ifndef RSPAMD_BLAKE2_H
  17. #define RSPAMD_BLAKE2_H
  18. #if defined(__cplusplus)
  19. extern "C" {
  20. #endif
  21. #define BLAKE2B_BLOCKBYTES 128
  22. #define BLAKE2B_OUTBYTES 64
  23. #define BLAKE2B_KEYBYTES 64
  24. #define BLAKE2B_SALTBYTES 16
  25. #define BLAKE2B_PERSONALBYTES 16
  26. typedef struct blake2b_state_t {
  27. unsigned char opaque[256];
  28. } blake2b_state;
  29. /* incremental */
  30. void blake2b_init (blake2b_state *S);
  31. void blake2b_keyed_init (blake2b_state *S,
  32. const unsigned char *key,
  33. size_t keylen);
  34. void blake2b_update (blake2b_state *S,
  35. const unsigned char *in,
  36. size_t inlen);
  37. void blake2b_final (blake2b_state *S, unsigned char *hash);
  38. /* one-shot */
  39. void blake2b (unsigned char *hash,
  40. const unsigned char *in,
  41. size_t inlen);
  42. void blake2b_keyed (unsigned char *hash,
  43. const unsigned char *in,
  44. size_t inlen,
  45. const unsigned char *key,
  46. size_t keylen);
  47. const char* blake2b_load (void);
  48. #if defined(__cplusplus)
  49. }
  50. #endif
  51. #endif