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.

58 regels
1012 B

  1. /*
  2. hash_address.c version 20160722
  3. Andreas Hülsing
  4. Joost Rijneveld
  5. Public domain.
  6. */
  7. #include <stdint.h>
  8. void setLayerADRS(uint32_t adrs[8], uint32_t layer){
  9. adrs[0] = layer;
  10. }
  11. void setTreeADRS(uint32_t adrs[8], uint64_t tree){
  12. adrs[1] = (uint32_t) (tree >> 32);
  13. adrs[2] = (uint32_t) tree;
  14. }
  15. void setType(uint32_t adrs[8], uint32_t type){
  16. adrs[3] = type;
  17. int i;
  18. for(i = 4; i < 8; i++){
  19. adrs[i] = 0;
  20. }
  21. }
  22. void setKeyAndMask(uint32_t adrs[8], uint32_t keyAndMask){
  23. adrs[7] = keyAndMask;
  24. }
  25. // OTS
  26. void setOTSADRS(uint32_t adrs[8], uint32_t ots){
  27. adrs[4] = ots;
  28. }
  29. void setChainADRS(uint32_t adrs[8], uint32_t chain){
  30. adrs[5] = chain;
  31. }
  32. void setHashADRS(uint32_t adrs[8], uint32_t hash){
  33. adrs[6] = hash;
  34. }
  35. // L-tree
  36. void setLtreeADRS(uint32_t adrs[8], uint32_t ltree){
  37. adrs[4] = ltree;
  38. }
  39. // Hash Tree & L-tree
  40. void setTreeHeight(uint32_t adrs[8], uint32_t treeHeight){
  41. adrs[5] = treeHeight;
  42. }
  43. void setTreeIndex(uint32_t adrs[8], uint32_t treeIndex){
  44. adrs[6] = treeIndex;
  45. }