[UNIT] ROT1 Encrypt Strings

Submitted by:Jhon Smith

Date added:13 March, 2014

Category:Delphi

Delphi code example for [UNIT] ROT1 Encrypt Strings

Tags: encrypt , strings

Code Snippet:

unit ROT1;

{ Autor: The Swash
Purpose: Encrypt strings.
}

interface

function EncryptString(lpString:String):String;
function DecryptString(lpString:String):String;

implementation

function EncryptString(lpString:String):String;
var
i:Integer;
begin
If Length(lpString) > 0 Then
begin
For i := 1 to Length(lpString) do
begin
If Ord(lpString[i]) <> 255 Then
begin
Result:= Result + Chr(Ord(lpString[i])+ 1)
end else
begin
Result:= Result + Chr(0)
end;
end;
end;
end;

function DecryptString(lpString:String):String;
var
i:Integer;
begin
If Length(lpString) > 0 Then
begin
For i := 1 to Length(lpString) do
begin
If Ord(lpString[i]) <> 0 Then
begin
Result:= Result + Chr(Ord(lpString[i])- 1)
end else
begin
Result:= Result + Chr(255)
end;
end;
end;
end;
 
 

Comments