TIP: Click on subject to list as thread! ANSI
echo: delphi
to: BRAD CLARKE
from: RYAN POTTS
date: 1996-11-03 23:57:00
subject: Problem with ordinals

Brad Clarke wrote in a message to All:
 BC>  {Convert key string to array}
 BC>     For i := 1 To Length(KeyValue) do
 BC>         begin
 BC>            sTemp := Copy(KeyValue, i, 1);
 BC>             KeyChar[i] := Ord(sTemp);
 BC>         end;
This example is very similar to what you are trying to do.  it works well 
here.
function Encrypted( Decryptedstr : string ):string;
var loop    :byte;
    tempstr : string;
    tempint : integer;
begin
  fillchar( tempstr, sizeof( tempstr ), #0 );
  for loop := 1 to length( decryptedstr ) do
  begin
     tempint := ord( Decryptedstr[ loop ] );
     tempint := tempint - 14;   // Not a very sophisticated scheme, but
                                // should suffice as an example.
     tempstr := tempstr + chr( tempint );
  end;
  Encrypted := tempstr;
end;
function decrypted( Encryptedstr : string ):string;
var loop    :byte;
    tempstr : string;
    tempint : integer;
begin
  fillchar( tempstr, sizeof( tempstr ), #0 );
  for loop := 1 to length( Encryptedstr ) do
  begin
     tempint := ord( Encryptedstr[ loop ] );
     tempint := tempint + 14;
     tempstr := tempstr + chr( tempint );
  end;
  decrypted := trimright( tempstr );  // You might not need to trim the 
string,
                                      // but it doesn't hurt.
end;
Thanks,
           Ryan 
---
---------------
* Origin: Midnight Express, Fairlawn Ohio (1:157/110)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.