Solved

Encrypt string and decrypt string

Posted on 2000-02-21
4
372 Views
Last Modified: 2010-04-04
Hi

i have value in edit box some i want to encrypt, and be able to decypt it again

Esk
0
Comment
Question by:esk
4 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2543517
delete this copy..
0
 
LVL 2

Expert Comment

by:gikam
ID: 2544902
explain in detail what u really want to do
0
 

Accepted Solution

by:
Iliad earned 100 total points
ID: 2549954
Try to use the following :-

const
   C1 = 52845;   {Used for encryption  Master Password string}
           C2 = 11719;
           Key = 1234;

        { Standard Decryption algorithm - Copied from Borland}
        function Decrypt(const S: String; Key: Word): String;
        var
          I: byte;
        begin
          Result[0] := S[0];
          for I := 1 to Length(S) do begin
            Result[I] := char(byte(S[I]) xor (Key shr 8));
            Key := (byte(S[I]) + Key) * C1 + C2;
          end;
        end;

        { Standard Encryption algorithm - Copied from Borland}
        function Encrypt(const S: String; Key: Word): String;
        Var
          I: byte;
        begin
          Result[0] := S[0];
          for I := 1 to Length(S) do begin
            Result[I] := char(byte(S[I]) xor (Key shr 8));
            Key := (byte(Result[I]) + Key) * C1 + C2;
          end;
        end;

Code copied from DIL
0
 

Author Comment

by:esk
ID: 2550878
upps, i was looking on wrong, but i have give you the points
thanks Barry
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now