core4.c 652 B

123456789101112131415161718192021222324252627282930313233
  1. #include <stdio.h>
  2. #include "crypto_core_salsa20.h"
  3. unsigned char k[32] = {
  4. 1, 2, 3, 4, 5, 6, 7, 8
  5. , 9, 10, 11, 12, 13, 14, 15, 16
  6. ,201,202,203,204,205,206,207,208
  7. ,209,210,211,212,213,214,215,216
  8. } ;
  9. unsigned char in[16] = {
  10. 101,102,103,104,105,106,107,108
  11. ,109,110,111,112,113,114,115,116
  12. } ;
  13. unsigned char c[16] = {
  14. 101,120,112, 97,110,100, 32, 51
  15. , 50, 45, 98,121,116,101, 32,107
  16. } ;
  17. unsigned char out[64];
  18. int main()
  19. {
  20. int i;
  21. crypto_core_salsa20(out,in,k,c);
  22. for (i = 0;i < 64;++i) {
  23. if (i > 0) printf(","); else printf(" ");
  24. printf("%3d",(unsigned int) out[i]);
  25. if (i % 8 == 7) printf("\n");
  26. }
  27. return 0;
  28. }