Code Data

Please discuss general Delphi programming topics here.

Code Data

Postby mouse » October 28th, 2003, 8:33 pm

I need help to code my data before store it on data base and decode it when I want to use it

:?: any help please
Mouse @@@
mouse
Active Member
Active Member
 
Posts: 9
Joined: October 7th, 2003, 6:42 pm

Postby Johnny_Bit » October 29th, 2003, 7:14 pm

There are many ways of coding... you can try BlowFish (very good) IDEA, DSA, Triple DSA... but if you want simple coding try this:
Code: Select all
function transcode(S,K:byte):byte;
var
  i:integer;
begin
  i:=s xor k;
  if i>255 then
    i:=i-255;
  if i<0 then
    i:=i+255;
  result:=i;
end;

function EnCode(Source:String;Key:Byte):String;
var
  i:integer;
begin
  if length(source)=0 then exit;
  Result:='';
  for i:=1 to length(source) do
    begin
      Result:=Result+chr(transcode(ord(source[i]),key));
    end;
end;

function Decode(Source:String;Key:Byte):String;
begin
  Result:=Encode(source,key);
end;
Johnny_Bit
VIP Member
VIP Member
 
Posts: 455
Joined: June 15th, 2003, 9:56 am

Postby mouse » October 31st, 2003, 10:41 pm

Thanks for your help
Mouse @@@
mouse
Active Member
Active Member
 
Posts: 9
Joined: October 7th, 2003, 6:42 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 1 guest