Lena has already hashed a certain password string. Now she needs her Go program to compare the hashed password with a plaintext password that's been input by a user and saved within the inputPassword variable.
Below is the code Lena has written so far:
package main
import (
"fmt"
"log"
"golang.org/x/crypto/bcrypt"
)
func main() {
password := "OpenSesame"
b, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)
if err != nil {
log.Fatal(err)
}
var inputPassword string
fmt.Scanln(&inputPassword)
// What function from the 'bcrypt' package can we use to compare
// a hashed password with its possible plaintext equivalent?
if err := bcrypt.?(?, ?); err != nil {
log.Fatal(err)
}
fmt.Println("Passwords match!")
}
What function from the bcrypt hashed can help Lena compare a hashed password versus a plaintext password? Select the correct function, and also make sure that the correct variables are passed to it!