Drop component on your form, specify password in Key property, put any two cahracters to Salt property and get encrypted password from Result. You can play with it even at design-time.
|
|
Since the acUnixCrypt component uses one-way encryption algorithm, there is no way to decrypt the keys. For authentication you can only compare two encrypted passwords.
|
procedure TForm1.AuthenticationBtnClick(Sender: TObject);
|
begin
|
// we'd like to take salt from two first characters of username
|
acUnixCrypt1.Salt := Copy(RealUsername, 1, 2);
|
// asking for password
|
acUnixCrypt1.Key := InputBox('Authentication',
|
'Enter password:', '');
|
// comparing two encrypted passwords
|
if acUnixCrypt.Result <> RealCryptedPassword then
|
begin
|
ShowMessage('Authentication Failed!');
|
Application.Terminate;
|
end;
|
end;
|