This paper proposes a privacy-preserving consensus algorithm which enables all the agents in the directed network to eventually reach the weighted average of initial states, and while preserving the privacy of the initial state of each agent. A novel privacy-preserving scheme is proposed in our consensus algorithm where initial states are hidden in random values. We also develop detailed analysis based on our algorithm, including its convergence property and the topology condition of privacy leakages for each agent. It can be observed that final consensus point is independent of their initial values that can be arbitrary random values. Besides, when an eavesdropper exists and can intercept the data transmitted on the edges, we introduce an index to measure the privacy leakage degree of agents, and then analyze the degree of privacy leakage for each agent. Similarly, the degree for network privacy leakage is derived. Subsequently, we establish an optimization problem to find the optimal attacking strategy, and present a heuristic optimization algorithm based on the Sequential Least Squares Programming (SLSQP) to solve the proposed optimization problem. Finally, numerical experiments are designed to demonstrate the effectiveness of our algorithm.