How To Make A Key Generator

Table of contents:

How To Make A Key Generator
How To Make A Key Generator
Video: How To Make A Key Generator
Video: How to make a Key Generator KeyGen Tutorial 2023, February
Anonim

Software protection is probably the main problem that every developer faces. The easiest way to protect yourself is to use keys that are generated according to a certain principle. Writing a basic key generator is a classic task for novice C programmers, because allows you to emphasize aspects of working with symbols.

How to make a key generator
How to make a key generator

Instructions

Step 1

The key generator below is essentially an encryptor. The program will require the user to enter a first and last name, then translate each entered character into a numeric code and transform it according to a certain law. The user will be shown on the screen a key consisting of the same number of characters as the surname. The disadvantage of this algorithm is that the standardized number of characters in the key can be obtained only with standardized input data (ip address, value from the Windows registry).

Step 2

Request the last name, first name and patronymic of the user. In this case, in order to make the output key more convenient, only the surname will be used (the entered code will be read up to the first space, the rest will go to the buffer, which will need to be cleared if necessary). The data will be written to the char A [30] array. At the same time, enter an additional counter for i to remember how many characters were entered.

printf ("Enter the Surname and initials. [Vasiliev A.I.] n");

while (A [i-1]! = '')

{scanf ("% c", & A [i]); i ++;}

Step 3

Convert the last name. Despite the fact that the array is in char format, you can carry out any mathematical operations with it, since each character in C has its own numeric code. Therefore, create a loop from zero to the stored number of characters i. In the body of the loop, write the transformation for the element A [j], and then display it.

for (int j = 0; j

The validity check will be carried out by comparing the resulting and the given keys. For authorization, the user enters his last name and the code issued by your generator. A similar generator is installed inside the program, which converts the surname according to the same law, and then compares the entered values ​​character by character with what should have been obtained.

Step 4

The validity check will be carried out by comparing the resulting and given keys. For authorization, the user enters his last name and the code issued by your generator. A similar generator is installed inside the program, which converts the surname according to the same law, and then compares the entered values ​​character by character with what should have been obtained.

Popular by topic