Thread: Mario-KeyG-Me
View Single Post
Old 27-02-2016, 05:35 PM   #5
User Profile
Serial_Killer

 
Serial_Killer's Avatar
 
Join Date: Mon Jan 2011
Posts: 237

Cấp bậc: 14 [cin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1teamcin1team]
Sức sống: 0 / 334
Hoạt động: 79 / 7364
Kinh nghiệm: 39%


Thanks: 11
Thanked 725 Times in 232 Posts
Default

hi Kruzco

next time, if you can, include option to disable music.

btw, nice newbie challange, keep going.

here is a lil gift for you.

Code:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, StrUtils;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Btn1: TButton;
    procedure Btn1Click(Sender: TObject);
  private
    { Private-Declarations }
  public
    { Public-Declarations }
  end;

var
  Form1: TForm1;

implementation
uses MD5_mod;

{$R *.dfm}

procedure TForm1.Btn1Click(Sender: TObject);
var
  szName, szSerial:string;
  i,j:Byte;

begin
  szName := ReverseString(edit1.text);
  if Length(szName) >= 5 then
  begin
    szName := szName + '47DD97AC7A70920D73FA1CF88C0AEE17' ;
    szName := Copy(ReverseString(StrMD5(szName)),1,16);
    szSerial := 'K';
    j:=1;
    for i := 1 to 19 do
    begin
      if (i mod 5) = 0 then
      begin
        szSerial := szSerial + '-' ;
        dec(j);
      end else
        szSerial:= szSerial + szName[j];
      inc(j);
    end;
    Edit2.Text := szSerial;
  end;

end;

end.
and ofc the md5 unit, just to complete the project

Code:
unit MD5_mod;

interface

uses
SysUtils;

const
MD5Version         = 102;
CopyRight : String = ' MD5 Message-Digest (c) 97-98 F. Piette V1.02 ';

{$Q-}
{$R-}

type
TMD5Context = record
    State: array[0..3] of LongInt;
    Count: array[0..1] of LongInt;
    case Integer of
    0: (BufChar: array[0..63] of Byte);
    1: (BufLong: array[0..15] of LongInt);
end;

TMD5Digest = array[0..15] of Char;

procedure MD5Init(var MD5Context: TMD5Context);
procedure MD5Update(var MD5Context: TMD5Context; const Data; Len: Integer);
procedure MD5Transform(var Buf: array of LongInt; const Data: array of LongInt);
procedure MD5UpdateBuffer(var MD5Context: TMD5Context; Buffer: Pointer; BufSize: Integer);
procedure MD5Final(var Digest: TMD5Digest; var MD5Context: TMD5Context);

function GetMD5(Buffer: Pointer; BufSize: Integer): string;
function StrMD5(Buffer : String): string;

implementation

const
MaxBufSize = 16384;

type
PMD5Buffer = ^TMD5Buffer;
TMD5Buffer = array[0..(MaxBufSize - 1)] of Char;


{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

{ MD5 initialization. Begins an MD5 operation, writing a new context.         }
procedure MD5Init(var MD5Context: TMD5Context);
begin

	FillChar(MD5Context, SizeOf(TMD5Context), #0);
	with MD5Context do begin

    	{ Load magic initialization constants. }
    	State[0] := LongInt($067452301);
    	State[1] := LongInt($0EFCDAB89);
    	State[2] := LongInt($098B5DCFE);
    	State[3] := LongInt($010365476);
	end;

end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

{ MD5 block update operation. Continues an MD5 message-digest operation,	}
{ processing another message block, and updating the context.							}
procedure MD5Update(
											var MD5Context: TMD5Context;	{ Context								}
											const Data;										{ Input block						}
											Len: Integer);								{ Length of input block	}

type
	TByteArray = array[0..0] of Byte;

var
	Index: Word;
	T: LongInt;

begin

	with MD5Context do begin
		T := Count[0];
		Inc(Count[0], LongInt(Len) shl 3);
		if Count[0] < T then
			Inc(Count[1]);

		Inc(Count[1], Len shr 29);
		T := (T shr 3) and $3F;
		Index := 0;
		if T <> 0 then begin
			Index := T;
			T := 64 - T;
			if Len < T then begin
				Move(Data, BufChar[Index], Len);
				Exit;
			end;

			Move(Data, BufChar[Index], T);
			MD5Transform(State, BufLong);
			Dec(Len, T);
			Index := T;  { Wolfgang Klein, 05/06/99 }
		end;

		while Len >= 64 do begin
			Move(TByteArray(Data)[Index], BufChar, 64);
			MD5Transform(State, BufLong);
			Inc(Index, 64);
			Dec(Len, 64);
		end;

		Move(TByteArray(Data)[Index], BufChar, Len);
	end
end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

{	MD5 finalization. Ends an MD5 message-digest operation, writing the message	}
{	digest and zeroizing the context.																					}
procedure MD5Final(var Digest: TMD5Digest; var MD5Context: TMD5Context);
var
    Cnt : Word;
    P   : Byte;

begin
	with MD5Context do begin
		Cnt := (Count[0] shr 3) and $3F;
		P := Cnt;
		BufChar[P] := $80;
		Inc(P);
		Cnt := 64 - 1 - Cnt;
		if Cnt < 8 then begin
			FillChar(BufChar[P], Cnt, #0);
			MD5Transform(State, BufLong);
			FillChar(BufChar, 56, #0);
		end
		else
			FillChar(BufChar[P], Cnt - 8, #0);

		BufLong[14] := Count[0];
		BufLong[15] := Count[1];
		MD5Transform(State, BufLong);
		Move(State, Digest, 16)
	end;
	FillChar(MD5Context, SizeOf(TMD5Context), #0)
end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

{	MD5 basic transformation. Transforms state based on block.	}
procedure MD5Transform(var Buf: array of LongInt; const Data: array of LongInt);
var
	A, B, C, D: LongInt;

	procedure Round1(var W: LongInt; X, Y, Z, Data1: LongInt; S: Byte);
	begin
		Inc(W, (Z xor (X and (Y xor Z))) + Data1);
		W := (W shl S) or (W shr (32 - S));
		Inc(W, X)
	end;

	procedure Round2(var W: LongInt; X, Y, Z, Data2: LongInt; S: Byte);
	begin
		Inc(W, (Y xor (Z and (X xor Y))) + Data2);
		W := (W shl S) or (W shr (32 - S));
		Inc(W, X)
	end;

	procedure Round3(var W: LongInt; X, Y, Z, Data3: LongInt; S: Byte);
	begin
		Inc(W, (X xor Y xor Z) + Data3);
		W := (W shl S) or (W shr (32 - S));
		Inc(W, X)
	end;

	procedure Round4(var W: LongInt; X, Y, Z, Data4: LongInt; S: Byte);
	begin
		Inc(W, (Y xor (X or not Z)) + Data4);
		W := (W shl S) or (W shr (32 - S));
		Inc(W, X)
	end;

begin
	A := Buf[0];
	B := Buf[1];
	C := Buf[2];
	D := Buf[3];

			Round1(A, B, C, D, Data[ 0] + LongInt($0D76AA478), $007);
			Round1(D, A, B, C, Data[ 1] + LongInt($0E8C7B756), $00C);
			Round1(C, D, A, B, Data[ 2] + LongInt($0242070DB), $011);
			Round1(B, C, D, A, Data[ 3] + LongInt($0C1BDCEEE), $016);
			Round1(A, B, C, D, Data[ 4] + LongInt($0F57C0FAF), $007);
			Round1(D, A, B, C, Data[ 5] + LongInt($04787C62A), $00C);
			Round1(C, D, A, B, Data[ 6] + LongInt($0A8304613), $011);
			Round1(B, C, D, A, Data[ 7] + LongInt($0FD469501), $016);
			Round1(A, B, C, D, Data[ 8] + LongInt($0698098D8), $007);
			Round1(D, A, B, C, Data[ 9] + LongInt($08B44F7AF), $00C);
			Round1(C, D, A, B, Data[10] + LongInt($0FFFF5BB1), $011);
			Round1(B, C, D, A, Data[11] + LongInt($0895CD7BE), $016);
			Round1(A, B, C, D, Data[12] + LongInt($06B901122), $007);
			Round1(D, A, B, C, Data[13] + LongInt($0FD987193), $00C);
			Round1(C, D, A, B, Data[14] + LongInt($0A679438E), $011);
			Round1(B, C, D, A, Data[15] + LongInt($049B40821), $016);

//=============================================================="

			Round2(A, B, C, D, Data[ 1] + LongInt($0F61E2562), $005);
   		Round2(D, A, B, C, Data[ 6] + LongInt($0C040B340), $009);
   		Round2(C, D, A, B, Data[11] + LongInt($0265E5A51), $00E);
   		Round2(B, C, D, A, Data[ 0] + LongInt($0E9B6C7AA), $014);
   		Round2(A, B, C, D, Data[ 5] + LongInt($0D62F105D), $005);
   		Round2(D, A, B, C, Data[10] + LongInt($002441453), $009);
   		Round2(C, D, A, B, Data[15] + LongInt($0D8A1E681), $00E);
   		Round2(B, C, D, A, Data[ 4] + LongInt($0E7D3FBC8), $014);
   		Round2(A, B, C, D, Data[ 9] + LongInt($021E1CDE6), $005);
   		Round2(D, A, B, C, Data[14] + LongInt($0C33707D6), $009);
   		Round2(C, D, A, B, Data[ 3] + LongInt($0F4D50D87), $00E);
   		Round2(B, C, D, A, Data[ 8] + LongInt($0455A14ED), $014);
   		Round2(A, B, C, D, Data[13] + LongInt($0A9E3E905), $005);
   		Round2(D, A, B, C, Data[ 2] + LongInt($0FCEFA3F8), $009);
   		Round2(C, D, A, B, Data[ 7] + LongInt($0676F02D9), $00E);
			Round2(B, C, D, A, Data[12] + LongInt($08D2A4C8A), $014);

//=============================================================="

    	Round3(A, B, C, D, Data[ 5] + LongInt($0FFFA3942), $004);
   		Round3(D, A, B, C, Data[ 8] + LongInt($08771F681), $00B);
   		Round3(C, D, A, B, Data[11] + LongInt($06D9D6122), $010);
   		Round3(B, C, D, A, Data[14] + LongInt($0FDE5380C), $017);
   		Round3(A, B, C, D, Data[ 1] + LongInt($0A4BEEA44), $004);
   		Round3(D, A, B, C, Data[ 4] + LongInt($04BDECFA9), $00B);
   		Round3(C, D, A, B, Data[ 7] + LongInt($0F6BB4B60), $010);
   		Round3(B, C, D, A, Data[10] + LongInt($0BEBFBC70), $017);
   		Round3(A, B, C, D, Data[13] + LongInt($0289B7EC6), $004);
   		Round3(D, A, B, C, Data[ 0] + LongInt($0EAA127FA), $00B);
   		Round3(C, D, A, B, Data[ 3] + LongInt($0D4EF3085), $010);
   		Round3(B, C, D, A, Data[ 6] + LongInt($004881D05), $017);
   		Round3(A, B, C, D, Data[ 9] + LongInt($0D9D4D039), $004);
   		Round3(D, A, B, C, Data[12] + LongInt($0E6DB99E5), $00B);
   		Round3(C, D, A, B, Data[15] + LongInt($01FA27CF8), $010);
   		Round3(B, C, D, A, Data[ 2] + LongInt($0C4AC5665), $017);

//=============================================================="

    	Round4(A, B, C, D, Data[ 0] + LongInt($0F4292244), $006);
   		Round4(D, A, B, C, Data[ 7] + LongInt($0432AFF97), $00A);
   		Round4(C, D, A, B, Data[14] + LongInt($0AB9423A7), $00F);
   		Round4(B, C, D, A, Data[ 5] + LongInt($0FC93A039), $015);
   		Round4(A, B, C, D, Data[12] + LongInt($0655B59C3), $006);
   		Round4(D, A, B, C, Data[ 3] + LongInt($08F0CCC92), $00A);
   		Round4(C, D, A, B, Data[10] + LongInt($0FFEFF47D), $00F);
   		Round4(B, C, D, A, Data[ 1] + LongInt($085845DD1), $015);
   		Round4(A, B, C, D, Data[ 8] + LongInt($06FA87E4F), $006);
   		Round4(D, A, B, C, Data[15] + LongInt($0FE2CE6E0), $00A);
   		Round4(C, D, A, B, Data[ 6] + LongInt($0A3014314), $00F);
   		Round4(B, C, D, A, Data[13] + LongInt($04E0811A1), $015);
   		Round4(A, B, C, D, Data[ 4] + LongInt($0F7537E82), $006);
   		Round4(D, A, B, C, Data[11] + LongInt($0BD3AF235), $00A);
   		Round4(C, D, A, B, Data[ 2] + LongInt($02AD7D2BB), $00F);
   		Round4(B, C, D, A, Data[ 9] + LongInt($0EB86D391), $015);

//=============================================================="

    Inc(Buf[0], A);
    Inc(Buf[1], B);
    Inc(Buf[2], C);
    Inc(Buf[3], D);
end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

procedure MD5UpdateBuffer(var MD5Context: TMD5Context; Buffer: Pointer; BufSize: Integer);
var
	BufTmp : PMD5Buffer;
 	BufPtr : PChar;
	Bytes  : Word;

begin
	New(BufTmp);
	BufPtr := Buffer;
	try
		repeat
			if BufSize > MaxBufSize then
				Bytes := MaxBufSize
			else
				Bytes := BufSize;

			Move(BufPtr^, BufTmp^, Bytes);
			Inc(BufPtr, Bytes);
			Dec(BufSize, Bytes);
			if Bytes > 0 then
				MD5Update(MD5Context, BufTmp^, Bytes);
		until Bytes < MaxBufSize;
	finally
		Dispose(BufTmp);
	end;
end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

function GetMD5(Buffer: Pointer; BufSize: Integer): string;
var
	I			: Integer;
	MD5Digest	: TMD5Digest;
	MD5Context	: TMD5Context;

begin
	for I := 0 to 15 do
		Byte(MD5Digest[I]) := I + 1;

	MD5Init(MD5Context);
	MD5UpdateBuffer(MD5Context, Buffer, BufSize);
	MD5Final(MD5Digest, MD5Context);
	Result := '';
	for I := 0 to 15 do
		Result := Result + IntToHex(Byte(MD5Digest[I]), 2);
end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

function StrMD5(Buffer : String): string;
begin
	Result := GetMD5(@Buffer[1], Length(Buffer));
end;

{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}

end.
to you wish the compiled code?

br
SK













Chữ k c nhn của Serial_Killer CRACK REQUESTS in PM will land on shitlist!!


Last edited by Serial_Killer; 27-02-2016 at 10:06 PM.
  Reply With Quote