Page 1 of 1

Code Data

PostPosted: October 28th, 2003, 8:33 pm
by mouse
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

PostPosted: October 29th, 2003, 7:14 pm
by Johnny_Bit
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;

PostPosted: October 31st, 2003, 10:41 pm
by mouse
Thanks for your help