How to calculate key size of a security algorithm? There are lots of security algorithms. One of the way to measure security of a cryptography algorithm is to find out its key size. There are many key size of a single algorithm.

ECC (Elliptic Curve Cryptography) has 163, 256, 384, 512 etc.
RSA has 1024, 3072, 7680, 15360. I found this from here

but how can I calculate key size of an algorithm? How a single algorithm has different key size?
I am building an simple cryptographic algorithm but I don't know how to calculate key size of my algorithm.
My algorithm is to change a letter of a plain text by a code suppose
a=2H, b=3C, c=8S ......, z=6D

If the plain text is &quot;cb&quot; then cipher text will be &quot;8S3C&quot;. So what will the key size of this algorithm be? How can I calculate it?
There are lots of security algorithms. One of the way to measure security of a cryptography algorithm is to find out its key size. There are many key size of a single algorithm. But how can I calculate key size of an algorithm? How a single algorithm has different key size? 


There is no standardized method that can help you with that. The best way to figure out the key sizes that are applicable is to lookup the standards that the algorithm should comply to. Furthermore, implementations may restrict those sizes further. If you are unlucky they may even expand the possible sizes of the input / output parameters (including the key size).

Lets take a look:


RSA: any key size will do (starting with a ridiculously low minimum), but usually the key size should be a multiple of 8 bits and possibly of a specific size or higher (e.g. > 1024 bits);
DH: the key size consists of two numbers, of which the size of the group is most important for security - specifying the key size is hard;
AES: AES has key sizes 128, 192 and 256 bits and the number of rounds changes for the different key sizes. AES is a subset of Rijndael which has key sizes 128, 160, 192, 224 and 256. The .NET classes that implement Rijndael only support the AES key sizes (but more block sizes);
Blowfish has a configurable key size of 32 bits up to 448 bits with steps of 8 its;
3DES has key sizes of 128 bit or 192 bit total, but the actual key size without parity bits is 112 and 168 bits respectively. The actual effective security is about 63-80 and 112 bits respectively.


This clearly shows you that key size is a tricky subject.


  My algorithm is to change a letter of a plain text by a code suppose a=2H, b=3C, c=8S ......, z=6D


The key size is what you define as the key size. You could define the string 2H3C8S ...... 6D as your key, given you a total key space of $10^{26}$ (for the digit in the code) times $26^{26}$ (for the letter in the code). Then the key size in bits is then $\log^2({10^{26} \times 26^{26}})$ or 20902 bits (!). Obviously the actual key size is somewhat smaller as you should not repeat codes (just like the parity bits for DES are not counted).

The effective key size is of course about zero as this is not a secure modern cipher.