def hash_len_valid(hash_str, hasht):
    """Makes sure hash length is valid for given hash type"""
    if len(hash_str) != hasht.hash_str_length():
        print('hash invalid. Expected size %d was %d\n' %
              (hasht.hash_str_length(), len(hash_str))
              )
        return False
    return True