What algorithm is used for registration algorithms like those for paid software?

Source: Internet
Author: User
What algorithm is used for registration algorithms like those for paid software? Development and Application of VCL Components
Http://www.delphi2007.net/DelphiVCL/html/delphi_20061224100656157.html
Registration of paid Software Algorithm What algorithm is generally used? Which algorithm is better if I want to encrypt my software? The elders gave me some comments.

// Resend

Delphi Program Registration Code Design

When you have worked so hard to use Delphi to prepare a program that you think is very good about, do you want to release it as a shared software? As a shared software, the registration code is indispensable. You can determine whether a program is registered for functions, time, or other restrictions. now we will introduce a simple registration code manufacturing method. the idea is as follows: check the registry before running the program. If the registration item is found, it indicates that it has been registered. If the registration item is not found, the system prompts registration.
<Registration routine>
Create a new project in Delphi and place the edit1, edit2, label1, label2, and button1 components.Code As follows:
Unit unit1;
Interface
Uses
Windows, messages, sysutils, classes, graphics, controls, forms, dialogs,
Stdctrls, registry; // Add registry here to call the registry.
Type
Tform1 = Class (tform)
Button1: tbutton;
Edit1: tedit;
Edit2: tedit;
Label1: tlabel;
Label2: tlabel;
Procedure button1click (Sender: tobject );
Procedure formcreate (Sender: tobject );
Private
Function check (): Boolean;
Procedure checkreg ();
Procedure createreg ();
{Private Declarations}
Public
{Public declarations}
End;
VaR
Form1: tform1;
Pname: string; // global variable, which stores the user name and registration code.
Ppass: integer;
Implementation
{$ R *. DFM}
Procedure tform1.createreg (); // create user information.
VaR Rego: Tregistry;
Begin
Rego: = Tregistry. Create;
Rego. rootkey: = HKEY_USERS;
Rego. openkey ('. Default \ Software \ angelsoft \ demo', true); // The key name is angelsoft \ demo, which can be modified by yourself.
Rego. writestring ('name', pname); // write user name.
Rego. writeinteger ('pass', ppass); // write the registration code.
Rego. Free;
Showmessage ('The program has been registered. Thank you! ');
Checkreg; // refresh.
End;
Procedure tform1.checkreg (); // check whether the program is registered in the registry.
VaR Rego: Tregistry;
Begin
Rego: = Tregistry. Create;
Rego. rootkey: = HKEY_USERS;
If Rego. openkey ('. Default \ Software \ angelsoft \ demo', false) then
Begin
Form1.caption: = 'Software registered ';
Button1.enabled: = false;
Label1.caption: = Rego. readstring ('name'); // read username.
Label2.caption: = inttostr (Rego. readinteger ('pass'); // read the registration code.
Rego. Free;
End
Else form1.caption: = 'Software not registered, please register ';
End;
Function tform1.check (): Boolean; // check whether the registration code is correct.
VaR
Temp: pchar;
Name: string;
C: Char;
I, long, pass: integer;
Begin
Pass: = 0;
Name: = edit1.text;
Long: = length (name );
For I: = 1 to long do
Begin
Temp: = pchar (copy (name, I, 1 ));
C: = temp ^;
Pass: = pass + ord (c); // convert each character of the user name into an ascii code and then add it.
End;
If strtoint (edit2.text) = pass then
Begin
Result: = true;
Pname: = Name;
Ppass: = pass;
End
Else result: = false;
End;
Procedure tform1.button1click (Sender: tobject );
Begin
If check then createreg
Else showmessage ('the registration code is incorrect and cannot be registered ');
End;
Procedure tform1.formcreate (Sender: tobject );
Begin
Checkreg;
End;
End.
<Registrar>
Create a new project in Delphi and place the edit1, edit2, and button1 components. The Code is as follows:
Unit unit1;
Interface
Uses
Windows, messages, sysutils, classes, graphics, controls, forms, dialogs,
Stdctrls;
Type
Tform1 = Class (tform)
Button1: tbutton;
Edit1: tedit;
Edit2: tedit;
Procedure button1click (Sender: tobject );
Private
{Private Declarations}
Public
{Public declarations}
End;
VaR
Form1: tform1;
Implementation
{$ R *. DFM}
Procedure tform1.button1click (Sender: tobject );
VaR
Temp: pchar;
Name: string;
C: Char;
I, long, pass: integer;
Begin
Pass: = 0;
Name: = edit1.text;
Long: = length (name );
For I: = 1 to long do
Begin
Temp: = pchar (copy (name, I, 1 ));
C: = temp ^;
Pass: = pass + ord (C );
End;
Edit2.text: = inttostr (PASS );
End;
End.
You can get the registration code from the <Registrar> to register in the <registration routine>. the principle is to use the Ord function to obtain the ASCII code value of each character of the user name and add the registration code. of course, this is very easy to crack. You can use XOR to perform an exclusive or operation, or reverse the value... it depends on how you implement it. in short, this Article It's just a reference.

You can also use special controls
Regware

Cracking is only a matter of time and interest

Before the software is successfully written, it is considered that the encryption is useless.
A poorly written software is an open source software that nobody else can use.

Interest in cracking before encryption

No one uses bad software without encryption, so good software encryption is still broken!
WinRAR encryption is good enough. How many software can achieve this? Still not killed
The author of the shared software should improve his software first. Don't start anti-cracking before it is successful, and try to use the wrong part.

One found:


You can check the value in the Registry for registration:
Of course, the registration code in this program is casually written...
Procedure te_mainf.formcreate (Sender: tobject );
VaR re_id: integer;
Registertemp: Tregistry;
Inputstr, get_id: string;
Dy, clickedok: Boolean;
I: Double;
Label y, N;
Begin
DY: = false; // indicates whether the software has reached the registration period and whether it is allowed to continue using. If the value is false, it indicates that the software is allowed to be used.
Registertemp: = Tregistry. Create; // prepare to use the registry
With registertemp do
Begin
Rootkey: = HKEY_LOCAL_MACHINE; // stored under this root
If openkey ('Software \ Microsoft \ Windows \ CurrentVersion \ mark', true) Then // create a directory to store the flag value. Of course, it can also be stored in an existing Directory.
Begin
If valueexists ('gc _ id') Then // use the value of gc_id as a flag, first determine whether it exists
Begin
Re_id: = readinteger ('gc _ id'); // read the flag value
If (re_id <> 0) and (re_id <> 100) Then // if the flag value is 0, it indicates that it has been registered. If it is not 0 and the value is less than 100, it indicates that, although not registered, the number of allowed times has not reached.
Begin
Re_id: = re_id + 5; // the maximum value of the allowed flag is 100. If you add 5 at a time, the maximum value is 20.
Writeinteger ('gc _ id', re_id); // write the updated flag value to the Registry.
I: = (100-re_id)/5;
If application. MessageBox (pansichar ('the software you are using has not been registered, and '+ floattostr (I) +' usage times, do you want to register now? '), 'Prompt information', mb_yesno + mb_iconwarning) = idyes then
Begin
If I = 0 then
Application. Terminate
Else
Goto y;
End;
End;
If re_id = 0 Then goto N;
If re_id = 100 then DY: = true; // if the flag value has reached 100, you should register
End
Else
Writeinteger ('gc _ id', 5); // create a flag and set the initial flag value.
Re_id: = readinteger ('gc _ id ');
I: = (100-re_id)/5;
If application. MessageBox (pansichar ('the software you are using has not been registered, and '+ floattostr (I) +' usage times, do you want to register now? '), 'Prompt information', mb_yesno + mb_iconwarning) = idyes then
Begin
If I = 0 then
Application. Terminate
Else
Goto y;
End;
End;
If dy then
Y: Begin // If the Dy value is true, the user should be prompted to enter the registration code for registration.
Clickedok: = inputquery ('System prompt ', 'Enter the registration code:', inputstr );
If clickedok then
Begin
Get_id: = inttostr (83392582*2); // The registration code is 166785164, which is simple enough ......
If get_id = inputstr then
Begin
Writeinteger ('gc _ id', 0); // If the entered registration code is correct, set the flag value to 0, that is, the registered
Application. MessageBox ('Congratulations, software registration is successful! ',' Hint ', mb_ OK );
Closekey;
Free;
End
Else
Begin
Application. MessageBox ('registration code error! Please contact the author! ',' Warning ', mb_ OK + mb_iconstop );
Closekey;
Free;
Application. Terminate; // stop the program and refuse to continue using it.
End;
End
Else
Begin
Closekey;
Free;
Application. Terminate; // stop the program and refuse to continue using it.
End;
End;
End;
N: datamodule1: = tdatamodule1.create (Self );
If not assigned (e_loginf) then
E_loginf: = te_loginf.create (Self );
E_loginf.showmodal;
If e_loginf.modalresult = mrcancel then // check the return mode. If it is disabled or canceled, stop the operation.
Begin
Application. Terminate;
Exit;
End;
I don't know if it meets your requirements ~~

It seems that there is no fixed answer to this question.
Everyone can think of an algorithm.

Agree to 4 stars

There are also hardware dongles that can be encrypted.

The more private the algorithm is, the better.
Otherwise, your encryption will be meaningless even if someone else uses the public algorithm.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.