hashPassword (NotesSession - JavaScript)

Hashes a string value so that it is not recognizable.

Defined in

NotesSession

Syntax

hashPassword(password:string) : string
Parameter Description
password The string to be hashed
.
Return value Description
string The hashed string.

Usage

An item of type "Password" is not secure. Its value can be read programmatically or by looking at the field in Properties. Use hashPassword to convert such a value to gibberish.

Use verifyPassword to examine a hashed value.

Examples

This button is for a page where the user enters values for a new password and its verification. The code hashes the text password then verifies the text verification against the hashed value.
var cpw = document1.getItemValueString("passwordCreate");
var vpw = document1.getItemValueString("passwordVerification");
if (cpw.length < 6 || vpw.length < 6) {
	requestScope.status = "Password must be at least 6 characters";
} else {
	var pw = session.hashPassword(cpw);
	if (session.verifyPassword(vpw, pw)) {
		document1.replaceItemValue("password", pw);
		document1.save();
		requestScope.status = "Password accepted";
	} else {
		requestScope.status = "Password verification failed";
	}
}