Hash a password

    result sample:
        $pbkdf2-256-1$8$FRakfnkgpMjnqs1Xxgjiwgycdf68be9b06451039cc\
        0f7075ec1c369fa36f055b1705ec7a

    The returned string is broken down into
        - The algorithm and version used
        - The cost factor, number of iterations over the hash
        - The salt
        - The password

def crypt(password, cost=2):
    """
    Hash a password

    result sample:
        $pbkdf2-256-1$8$FRakfnkgpMjnqs1Xxgjiwgycdf68be9b06451039cc\
        0f7075ec1c369fa36f055b1705ec7a

    The returned string is broken down into
        - The algorithm and version used
        - The cost factor, number of iterations over the hash
        - The salt
        - The password
    """

    salt = _generate_salt(cost)

    hashed = pbkdf2.pbkdf2_hex(password, salt, cost * 500)

    return "$pbkdf2-256-1$" + str(cost) + "$" + salt.decode("utf-8") + "$" + hashed