public boolean verifyPath(C leaf, C root, List<Pair<C,C>> path) {
		// Verify that the each pair contains a commitment
		// to the previous pair and that the first pair 
		// in the path contains the leaf
		C lasthash = leaf;
		for (Pair<C,C> pair : path) {
			if (!GenericsUtils.deepEquals(pair.a, lasthash) && !GenericsUtils.deepEquals(pair.b, lasthash))
				return false;
			lasthash = hashfunc.hash(pair);
		}
		// Verify that the path ends in root.
		if (!GenericsUtils.deepEquals(lasthash, root))
			return false;
		
		// All the tests passed.
		return true;
	}