Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
Solved

# Encrypt string and decrypt string

Posted on 2000-02-21
Medium Priority
400 Views
Hi

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

Esk
0
Question by:esk
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

LVL 17

Expert Comment

ID: 2543517
delete this copy..
0

LVL 2

Expert Comment

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

Accepted Solution

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

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

## Featured Post

Question has a verified solution.

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

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 Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
###### Suggested Courses
Course of the Month5 days, 2 hours left to enroll