Some encryption algorithms collected

Source: Internet
Author: User

Some of them were previously written when I learned to crack and write the registration machine. Some of them were written by some of my brother's code. It is not easy to write:

{===================================================== ======================
Learning to crack and writing some function sets of the registration Machine
By: black night rainbow
========================================================== =====================}
Function wzwgp (s: string): string; // obtain the accumulated value.
Var I, sum: integer;
Begin
Sum: = 0; for I: = 1 to length (s) do
Begin
Sum: = sum + ord (s [I]);
End;
Result: = inttostr (sum );
End;

Function ASCII10ADD (s: string): string; // obtain the accumulated value.
Var I, sum: integer;
Begin
Sum: = 0; for I: = 1 to length (s) do
Begin
Sum: = sum + ord (s [I]);
End;
Result: = inttostr (sum );
End;

Function ASCII16ADD (s: string): string; // obtain the accumulated value.
Var I, sum: integer;
Begin
Sum: = 0; for I: = 1 to length (s) do
Begin
Sum: = sum + ord (s [I]);
End;
Result: = inttohex (sum, 2 );
End;

Function float (a: integer): string;
Var I: integer;
S: Extended;
Begin
S: = 0;
I: = 1;
For I: = 1 to a do
Begin
S: = s + 1/I;
End;
Result: = FloatToStr (s );
End;

Function float2 (a: integer): string; // floating point mathematical operation
Var I: integer;
S: Extended;
Begin
S: = 0;
I: = 1;
For I: = 1 to a do
Begin
If I mod 2 <> 0 then
S: = s + 1/I
Else
S: = s-1/I;
End;
Result: = FloatToStr (s );
End;

Procedure TForm1.Button2Click (Sender: TObject );
Begin

Edit2.text: = float2 (100 );
End;
{++ ++}

Function StrToBack (s: string): string; // reverse the string.
Var I: integer;
Begin
For I: = 1 to length (s) do
Begin
Result: = s [I] + result;
End;
End;

{++ ++}

Function mdistr (str: string; int: integer): string; // obtain the middle part of the string.
Begin
If int <Length (str) div 2 then
Result: = copy (str, length (str) div 2, int)
Else
Result: = copy (str, Length (str) div 2-(int-Length (str) div 2), int );
End;

{++ ++}

Function StrToASCII16 (s: string): string; // string Conversion ascii code hexadecimal
Var I: integer;
Begin
For I: = 1 to length (s) do
Begin
Result: = result + IntToHex (ord (s [I]), 2 );
End;
End;

{++ ++}

Function StrToASCII10 (s: string): string; // string Conversion ascii code 10
Var I: integer;
Begin
For I: = 1 to length (s) do
Begin
Result: = result + inttostr (ord (s [I]);
End;
End;

{++ ++}

Function StrToASCII16 (s: string): string; // string Conversion ascii code hexadecimal,
Var I: integer; // such as: black night rainbow = $ BA, $ DA, $ D2, $ B9, $ B2, $ CA, $ BA, $ E7
Begin
For I: = 1 to length (s) do
Begin
Result: = result + $ + IntToHex (ord (s [I]), 2) + ,;
End;
Result: = copy (Result, 0, Length (result)-1 );
End;

{++ ++}
Function DoubleStr (Str: string): string; // returns the double-digit string.
Var
I: Integer;
Begin
Result: =;
For I: = 2 to Length (Str) do
If I mod 2 = 0 then
Result: = Result + Str [I];
End;

{++ ++}

Function WideStr (str: string): String; // extract Chinese characters from the string
Var I: Integer;
Begin
For I: = 1 to Length (WideString (Str) do
If Length (string (WideString (Str) [I]) = 2 then
Result: = result + WideString (Str) [I];
End;

{++ ++}

Function StrSubCount (const Source, Sub: string): integer; // determines the number of characters in a string.
Var Buf: string;
Len, I: integer;
Begin
Result: = 0;
Buf: = Source;
I: = Pos (Sub, Buf );
Len: = Length (Sub );
While I <> 0 do
Begin
Inc (Result );
Delete (Buf, 1, I + Len-1 );
I: = Pos (Sub, Buf );
End;
End;

{++ ++}

Function ByteToHex (Src: Byte): String;
Begin
SetLength (Result, 2 );
Asm
Mov edi, [Result]
Mov edi, [EDI]
Mov al, Src
Mov ah, AL // Save to AH
Shr al, 4 // Output High 4 Bits
Add al, 0
Cmp al, 9
JBE @ OutCharLo
Add al, A-9-1
@ OutCharLo:
And ah, $ f
Add ah, 0
Cmp ah, 9
JBE @ OutChar
Add ah, A-9-1
@ OutChar:
STOSW
End;
End;

{++ ++}

Function ShiftStr (str1, str2: string): string; // shift string
Var I: integer;
Begin
Result: =;
For I: = 1 to length (str1) do
Begin
Result: = Result + str1 [I] + str2 [I];
End;
End;

Function SiftStr (Str: string): string; // filter string
Var I, j: integer;
Begin
Result: =;
J: = Length (str );
For I: = 0 to j do
Begin
If str [I] in [0 .. 9, a. f, A. F] then
Result: = Result + str [I];
End;
End;

Function IsNum (str: string; int, int2: integer): string;
Var I: integer;
Begin
For I: = 1 to length (str) do
Begin
Result: = inttostr (StrToInt ($ + str [I]) or int) mod int2) + result;
End;
End;

{++ ++}
Function OpeateStr (const s: string): string; // character-by-bit xor operation
Con

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.