Created
June 21, 2012 09:12
-
-
Save cpamungkas/2964768 to your computer and use it in GitHub Desktop.
Generator Random Key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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