Solved

Encrypt string and decrypt string

Posted on 2000-02-21
4
368 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 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

17 Experts available now in Live!

Get 1:1 Help Now