佚名 向大家分享了总结一些加密算法 ,其中包含数据加密算法,加密算法,软件加密算法,rsa加密算法,对称加密算法等知识点,遇到此问题的同学们可以参考下
有一些是之前学破解写注册机时写的,一些是我改写某些兄弟的代码来的,写的不好多多指教:
{=======================================================
学习破解,写注册机的一些函数集
By:黑夜彩虹
========================================================}
function wzwgp(s: string): string; //取累加值
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; //取累加值
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; //取累加值
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; //浮点数学运算
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; //将字符串倒转过来
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; //取字符串的中间部份
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; //字符串转换ascii码16进制
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; //字符串转换ascii码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; //字符串转换ascii码16进制,
var i:integer; // 如:黑夜彩虹=$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; //取字符串偶位数字符
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; //取出字符串中的汉字
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; //判断某字符在字符串中的个数
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; //移位字符串
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; //过滤字符串
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; //字符逐位 xor 运算
const
snLen = 5 ;
sn:array[1..snLen] of Integer =($0D, $01, $14, $05,$02);
var
i,n: integer;
begin
setLength(result,Length(s));
for i :=1 to Length(s) do begin
n := i mod snLen ;
if n = 0 then
n := 5 ;
result[i] := char(ord(s[i]) xor sn[n]);
end;
end;
{ }
function StrToEncrypt(Str,ID,Pass:string): string; //销售王进销存_keygen算法
var
username: string;
a, b, c_str, c_hex, d, e, f: string;
I, a_len: Integer;
begin
username:=str;
a:=id str;
//b:= 'MraketSoft62095231';
b:=pass;
a_len := Length(a);
c_str := '';
c_hex := '';
for I := 1 to a_len do
begin
c_hex := c_hex IntToHex(Byte(a[I]) xor Byte(b[I mod Length(b)]), 2) ' ';
c_str := c_str Chr(Byte(a[I]) xor Byte(b[I mod Length(b)
{=======================================================
学习破解,写注册机的一些函数集
By:黑夜彩虹
========================================================}
function wzwgp(s: string): string; //取累加值
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; //取累加值
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; //取累加值
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; //浮点数学运算
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; //将字符串倒转过来
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; //取字符串的中间部份
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; //字符串转换ascii码16进制
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; //字符串转换ascii码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; //字符串转换ascii码16进制,
var i:integer; // 如:黑夜彩虹=$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; //取字符串偶位数字符
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; //取出字符串中的汉字
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; //判断某字符在字符串中的个数
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; //移位字符串
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; //过滤字符串
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; //字符逐位 xor 运算
const
snLen = 5 ;
sn:array[1..snLen] of Integer =($0D, $01, $14, $05,$02);
var
i,n: integer;
begin
setLength(result,Length(s));
for i :=1 to Length(s) do begin
n := i mod snLen ;
if n = 0 then
n := 5 ;
result[i] := char(ord(s[i]) xor sn[n]);
end;
end;
{ }
function StrToEncrypt(Str,ID,Pass:string): string; //销售王进销存_keygen算法
var
username: string;
a, b, c_str, c_hex, d, e, f: string;
I, a_len: Integer;
begin
username:=str;
a:=id str;
//b:= 'MraketSoft62095231';
b:=pass;
a_len := Length(a);
c_str := '';
c_hex := '';
for I := 1 to a_len do
begin
c_hex := c_hex IntToHex(Byte(a[I]) xor Byte(b[I mod Length(b)]), 2) ' ';
c_str := c_str Chr(Byte(a[I]) xor Byte(b[I mod Length(b)

