Create and implement (in any programming language) an algorithm to manage passwords

Create and implement (in any programming language) an
algorithm to manage passwords. This program must:

  1. Step 1 – store the user password
    a. Request a password from the user(s)
    b. The user enters his password
    c. The program generates a random salt for each user.
    d. It adds the salt (at the middle) to the user’s password
    and the hash the password + salt and stores the hashed
    password and the salt to a file (may store the user’s
    name or ID if any).
  2. Step 2 – verify the password
    a. Request the user password
    b. Read the saved salt, add it to password and hash salt +
    password.
    c. Compare the result obtained with the stored hash. If
    they are the same the user is authenticated.