Encrypt string and decrypt string

Posted on 2000-02-21
Last Modified: 2010-04-04

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

Question by:esk
LVL 17

Expert Comment

ID: 2543517
delete this copy..

Expert Comment

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

Accepted Solution

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

   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;
          I: byte;
          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;

        { Standard Encryption algorithm - Copied from Borland}
        function Encrypt(const S: String; Key: Word): String;
          I: byte;
          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;

Code copied from DIL

Author Comment

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 157
indy Tmemory stream non latin charcter issue 2 110
Printing problem 2 93
Reconfigure Delphi Install? 2 51
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

772 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