Subject | Re: Need help with FB XOR UDF, please |
---|---|
Author | Leonardo Cosmai |
Post date | 2005-06-03T19:08:42Z |
Hi, try this:
procedure Str2Str(Value:PChar; Key: integer; ValueOut:PChar);
var
P : PChar;
begin
RANDSEED := Key;
P := Value;
while P^ <> #0 do begin
ValueOut^ := Chr(Ord(P^) XOR (RANDOM(254)+1));
Inc(P);
Inc(ValueOut);
end;
ValueOut^ := #0;
end;
and declare it with:
DECLARE EXTERNAL FUNCTION F_STR2STR
CSTRING(3072),
INTEGER,
CSTRING(3072)
RETURNS PARAMETER 3
ENTRY_POINT 'Str2Str' MODULE_NAME 'FreeUDFLib.dll'
Ciao.
L.
procedure Str2Str(Value:PChar; Key: integer; ValueOut:PChar);
var
P : PChar;
begin
RANDSEED := Key;
P := Value;
while P^ <> #0 do begin
ValueOut^ := Chr(Ord(P^) XOR (RANDOM(254)+1));
Inc(P);
Inc(ValueOut);
end;
ValueOut^ := #0;
end;
and declare it with:
DECLARE EXTERNAL FUNCTION F_STR2STR
CSTRING(3072),
INTEGER,
CSTRING(3072)
RETURNS PARAMETER 3
ENTRY_POINT 'Str2Str' MODULE_NAME 'FreeUDFLib.dll'
Ciao.
L.