IMetabaseSecurity.HashPassword

Syntax

HashPassword(Password: String): String;

Parameters

Password is the password that needs hashing.

Description

The HashPassword method hashes the password.

Example

Executing the example requires a form with the Button1 button, the EditBox component named EditBox1 and the Memo component named Memo1. The example is executed on clicking the button.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Mb: IMetabase;

MbUser: IMetabaseUser;

MbSecurity: IMetabaseSecurity;

HashP: String;

MbPassHistory: IPasswordHistory;

Begin

Mb := MetabaseClass.Active;

MbSecurity := Mb.Security;

MbUser := MbSecurity.ResolveName("ADMIN") As IMetabaseUser;

HashP := MbSecurity.HashPassword(EditBox1.Text);

MbPassHistory := MbUser.PasswordHistory;

If MbPassHistory.Contains(HashP) Then

Memo1.Lines.Add("Password '" + EditBox1.Text + "' is already in history");

Else MbPassHistory.Insert(HashP);

Memo1.Lines.Add("Password '" + EditBox1.Text + "' is added in history");

End If;

MbSecurity.Apply;

End Sub Button1OnClick;

After executing this example the password entered by the user in the EditBox component is checked whether it is in history. The result of check is displayed in the Memo component.

See also:

IMetabaseSecurity