def check_passwd(guess, passwd):
    """
    Tests to see if the guess, after salting and hashing, matches the
    passwd from the database.

    @param guess: incoming password trying to be used for authentication
    @param passwd: already encrypted password from the database

    @returns: boolean
    """
    m = sha1()
    salt = passwd[:salt_len * 2]  # salt_len * 2 due to encode('hex_codec')
    m.update(unicode2bytes(guess) + unicode2bytes(salt))
    crypted_guess = bytes2unicode(salt) + m.hexdigest()

    return (crypted_guess == bytes2unicode(passwd))
Tests to see if the guess, after salting and hashing, matches the
    passwd from the database.

    @param guess: incoming password trying to be used for authentication
    @param passwd: already encrypted password from the database

    @returns: boolean