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.

37 lines
581 B

  1. #include <stdio.h>
  2. #include "../prg.h"
  3. static void hexdump(unsigned char *a, size_t len)
  4. {
  5. size_t i;
  6. for (i = 0; i < len; i++)
  7. printf("%02x", a[i]);
  8. }
  9. int main()
  10. {
  11. int n = 32;
  12. unsigned char seed[32] = {0};
  13. // unsigned char seed[64] = {0,0};
  14. unsigned char out[2*n];
  15. unsigned char addr[16] = {2};
  16. printf("Case 1: All 0\n");
  17. prg(out, 2*n, seed, n);
  18. printf("\n");
  19. hexdump(out, 2*n);
  20. printf("\n");
  21. printf("Case 2: key = 1\n");
  22. seed[31] = 1;
  23. prg_with_counter(out, seed, n, addr);
  24. printf("\n");
  25. hexdump(out, n);
  26. printf("\n");
  27. return 0;
  28. }