fork(1) download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4.  
  5. static char xtea_key[17];
  6. static const int XTEA_KEY_SIZE = 16; /* bytes */
  7. static const int XTEA_KEY_RANGE = 58; /* ASCII letters*/
  8.  
  9. void gen_xtea_key(void)
  10. {
  11. int i;
  12.  
  13. srand(time(NULL));
  14. for (i = 0; i < XTEA_KEY_SIZE; i++)
  15. {
  16. if (i < XTEA_KEY_SIZE) xtea_key[i] = rand() % XTEA_KEY_RANGE + 'A';
  17. else xtea_key[i] = 0;
  18. printf("c = %c, d = %u\n", xtea_key[i], xtea_key[i]);
  19. }
  20. }
  21.  
  22. int main() {
  23. gen_xtea_key();
  24. printf("key = %s\n", xtea_key);
  25. return 0;
  26. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
c = T, d = 84
c = A, d = 65
c = F, d = 70
c = t, d = 116
c = g, d = 103
c = y, d = 121
c = W, d = 87
c = ^, d = 94
c = D, d = 68
c = p, d = 112
c = S, d = 83
c = G, d = 71
c = a, d = 97
c = F, d = 70
c = x, d = 120
c = h, d = 104
key = TAFtgyW^DpSGaFxh