Hack Forums
[Delphi] [Delphi] String Crypter [Snippet] [Clearing out old Delphi Folder] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: [Delphi] [Delphi] String Crypter [Snippet] [Clearing out old Delphi Folder] (/showthread.php?tid=661240)



[Delphi] String Crypter [Snippet] [Clearing out old Delphi Folder] - Symbiotic - Sep 5, 2010

For all of my Delphi tutorials and snippets check out: https://hackforums.net/showthread.php?tid=702578


Finished Result: [IMG]http://i277.photobucket.com/albums/kk68/sadr_disturbed/DelphiCrypter.jpg[/IMG]

Add two buttons, two labels, and 1 edit. Place them as I did in my finished result picture.

Code:
Code
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    Label1: TLabel;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    function encrypt(const Value : String) : String;
    procedure FormCreate(Sender: TObject);

  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
implementation

{$R *.dfm}

function TForm1.Encrypt(const Value : String) : String;
var
  CIndex: integer;
begin
  Result := Value;
  for CIndex := 2 to Length(Value) do
  Result[CIndex] := chr(not(ord(Value[CIndex])));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
label2.caption := Encrypt(Edit1.Text);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
label1.caption := Encrypt(label2.caption);
end;

Clearing out some of my old Delphi stuff, found this. Can't remember where I learned it from or even if I got it off of a website or if I just made it; if you find somewhere please pm me so I can add credits.


* - magerstenk - Sep 7, 2010

Hey, I'm realizing the same program too. How did you make the text start automatically on a new paragraph in the edit?
thx man :)


* - jackman - Sep 7, 2010

As no one has said thank you yet, here it comes: Thank you! :P probably will help me alot :)


* - Symbiotic - Sep 13, 2010

Thanks jackman glad you enjoyed this!


* - Joseph Ducreux - Oct 7, 2010

what method of encryption is this?


* - DrSponge - Oct 29, 2010

It just changes the order of the character code.
Meaning A would become something like G if it changed the order by 6 going forward


* - Joseph Ducreux - Oct 29, 2010

(Oct 29, 2010 12:42 PM)live4eva Wrote:  It just changes the order of the character code.
Meaning A would become something like G if it changed the order by 6 going forward

usually code is self explanatory but I didn't get this one
thanks OP!


* - Symbiotic - Oct 30, 2010

No problem glad everyone enjoyed it.


* - Amazighi-Hkr - Aug 7, 2011

thank's mr Symbiotic for sharing


* - connorbp - Feb 7, 2012

I have been looking for something like this for so long! :D thanks so much.


* - Xogg - Jul 28, 2017

Reading old threads for fun.

Also for anyone thats interested: you could do this easier by using the component Lock Box 3
https://sourceforge.net/projects/tplockbox/