|
-
December 7th, 1999, 12:42 PM
#1
Delphi to VB Conversion Help
I need these two functions converted to VB...
Can someone help, please???
function Decrypt(const S: String; Key: Word): String;
var
I: byte;
begin
SetLength(Result,Length(S));
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;
function Encrypt(const S: String; Key: Word): String;
var
I: byte;
begin
SetLength(Result,Length(S));
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;
-
December 8th, 1999, 01:20 AM
#2
Re: Delphi to VB Conversion Help
I'm not sure if this is exactly word for word, but I hope you will get the basic of encrypting/decrypting:
private Function Decrypt(byval SEnc as string)
for I = 1 to len(SEnc)
Str = mid(SEnc, I, 1)
mid(SEnc, I, 1) = Chr(Asc(Str) - 1)
next
Decrypt = SEnc
End Function
private Function Encrypt(byval S as string)
for I = 1 to len(S)
Str= mid(S, I, 1)
mid(S, I, 1) = Chr(Asc(Str) + 1)
next
Encrypt = S
End Function
-
December 8th, 1999, 10:09 AM
#3
Re: Delphi to VB Conversion Help
I'm afraid that would not do what I'm looking for.
I need to be able to use the same table in both
applications so the strings MUST be identical when
encrypted by EITHER the Delphi program or the VB
program.
Thanks for trying...
-
December 8th, 1999, 05:01 PM
#4
Re: Delphi to VB Conversion Help
You can make a textbox and use Encrypt and Decrypt functions to get the string from that that textbox....
-
December 9th, 1999, 11:38 AM
#5
Re: Delphi to VB Conversion Help
What the hell are you talking about? I already have the text boxes and I want to encrypt/decrypt the values in those text boxes as well as values in the
fields of a table.
I just want the algorithm I posted converted to VB so I can use the SAME DATA
in BOTH APPLICATIONS!!!!!
-
December 10th, 1999, 04:57 AM
#6
Re: Delphi to VB Conversion Help
I DOnt know Delphi.. and i use to know (?) Pascal!. So what is shr : "Shift right" is what i guessed. But then shift right 8 times with or w/o carry (meaning loop back or not)? What are C1 and C2?
RK
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|