25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
1.2 KiB

  1. #ifndef PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_HASH_STATE_H
  2. #define PQCLEAN_SPHINCSSHAKE256128FSIMPLE_AVX2_HASH_STATE_H
  3. /**
  4. * Defines the type of the hash function state.
  5. *
  6. * Don't be fooled into thinking this instance of SPHINCS+ isn't stateless!
  7. *
  8. * From Section 7.2.2 from the SPHINCS+ round-2 specification:
  9. *
  10. * Each of the instances of the tweakable hash function take PK.seed as its
  11. * first input, which is constant for a given key pair – and, thus, across
  12. * a single signature. This leads to a lot of redundant computation. To remedy
  13. * this, we pad PK.seed to the length of a full 64-byte SHA-256 input block.
  14. * Because of the Merkle-Damgård construction that underlies SHA-256, this
  15. * allows for reuse of the intermediate SHA-256 state after the initial call to
  16. * the compression function which improves performance.
  17. *
  18. * We pass this hash state around in functions, because otherwise we need to
  19. * have a global variable.
  20. *
  21. * SHAKE256 does not need this state. Because this implementation is generated
  22. * from a shared code base, we still need to specify some hash_state as it is
  23. * still passed around. We chose to use an `int` as a placeholder for this
  24. * purpose.
  25. */
  26. typedef int hash_state;
  27. #endif