Example: Using security.BCrypt methods

This example creates (and checks) a hash password as BCrypt results.

IMPORT SECURITY

MAIN
   DEFINE salt STRING
   DEFINE hashed_pass STRING
   LET salt = Security.BCrypt.GenerateSalt(12)
  
   CALL Security.BCrypt.HashPassword(arg_val(1), salt) RETURNING hashed_pass
   DISPLAY "Hashed password is :",hashed_pass  
  
   IF Security.BCrypt.CheckPassword(arg_val(1), hashed_pass) THEN
     DISPLAY "OK: password check done."
   ELSE
     DISPLAY "KO: password check failed."
   END IF
END MAIN