Re: text encryptionPosted by Annie on February 02, 2005
The easiest but weakest encryption is: add a fixed number to the code of each character. Encryption: for i := 1 to Length(S) do S[i] := Char(Ord(S[i] + 8); Decryption: for i := 1 to Length(S) do S[i] := Char(Ord(S[i] - 8); If you have to encrypt short strings like names, this is maybe enough. A bit safer: add or subtract different numbers, depending form the place of the character in the string. In both cases, make sure that an encrypted character code doesn't exceed 255. Look up in an ASCII table: the code for the highest character that you expect, subtract this from 255, and that's your maximum number that can be added. Succes! |