# Calculating permutations of a hexadecimal character set [closed]

How long would it take to run through all permutations/combinations of a ten character set; assuming the character-set is limited to a hexadecimal alphabet? (i.e. 16 characters {0..9}{A..F}; eg. A1B2C3D4E5 or A7454F4F74).

I'm not sure of a realistic speed/rate/frequency (i.e. x.words/second; y.words/minute) but maybe someone here does.

Or maybe I should start with; how many possible combinations/permutations exist? And in the future; how could i figure it out by myself? (i.e. is it simply something like 10^16?)

## closed as off-topic by symcbean, S.L. Barth, WhiteWinterWolf, techraf, AndersAug 30 '16 at 9:41

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question does not appear to be about Information security within the scope defined in the help center." – WhiteWinterWolf, Anders
If this question can be reworded to fit the rules in the help center, please edit the question.

To answer the latter, 16^10, since every character has 16 possible options over a total length of 10. Or `16 * 16 * 16 ....` which results in 1,099,511,627,776 possible combinations. Now if we were count to this number as fast as possible (some optimized C script) and print the numbers to screen, it would take approximately 10 seconds per 10000000 iterations, or 1099511 seconds, 12 days. This is only if we would count from 0 and print each number.

A simple c program to calculate permutations only

``````#include <stdio.h>
#include <string.h>

void swap(char *x, char *y) {
char temp;
temp = *x;
*x = *y;
*y = temp;
}

void permute(char *a, int l, int r) {
int i;
if (l == r) {
printf("%s\n", a);
} else {
for (i = l; i <= r; ++i) {
swap((a + l), (a + i));
permute(a, l + 1, r);
swap((a + l), (a + i));
}
}
}

int main(int argc, char *argv[]) {
char str[] = "ABCDEF0123456789";
permute(str, 0, strlen(str) - 1);
return 0;
}
``````

This does not cover the entire space, but gives a good indication. Remember this does swappable permutations only, and is by no means complete. Calculating possible permutations over 10 characters takes about 20 seconds on average. Every character add about 10 times the previous runtime since this is an exponential growth, 11 characters will already take about 3 minutes, and so on. A rough indication would estimate all permutations over 16 characters to take up to 230 days. In practice this will be more, since you do not just want to print the combinations to screen.

To speedup the process you should divide the domain and run combinations in parallel.

Assuming the sequence is important, the number of possible permutations of a 10-character string of hexadecimal characters (16-unique characters) would be = 16 x 16 x ...(10 times) = 16^10 = 1,099,511,627,776 This is a little more than a quadrillion.

• The sequence is not important at all. Any sequence will do; just as long as there aren't duplicates per set. – tjt263 Aug 30 '16 at 14:22
• But I think your conclusion is correct. – tjt263 Aug 30 '16 at 15:19
• Ohh. I see what you mean now. Yes. In that context, sequence is important. (i.e. permutations, rather than combinations). – tjt263 Aug 31 '16 at 6:39