Skip to content

Instantly share code, notes, and snippets.

@cpamungkas
Created June 21, 2012 09:12
Show Gist options
  • Save cpamungkas/2964768 to your computer and use it in GitHub Desktop.
Save cpamungkas/2964768 to your computer and use it in GitHub Desktop.
Generator Random Key
function GeneratePWDSecutityString: string;
const
Codes64 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz+/';
var
i, x: integer;
s1, s2: string;
begin
s1 := Codes64;
s2 := '';
for i := 0 to 15 do
begin
x := Random(Length(s1));
x := Length(s1) - x;
s2 := s2 + s1[x];
s1 := Copy(s1, 1,x - 1) + Copy(s1, x + 1,Length(s1));
end;
Result := s2;
end;
//contoh pemanggilannya
procedure TForm1.btn2Click(Sender: TObject);
begin
Edit1.Text := GeneratePWDSecutityString();
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment