Proving P=NP would not necessarily give you an algorithm, because there are many different methods to prove something (i.e. [Direct proof][1], [Proof by contradiction][2], etc.).

But it is shown that if you were to find a polynomial time algorithm to solve a NP-complete problem that you could modify that algorithm to solve all NP-problems, including the [Integer factorization][3] problem.


  [1]: https://en.wikipedia.org/wiki/Direct_proof
  [2]: https://en.wikipedia.org/wiki/Proof_by_contradiction
  [3]: https://en.wikipedia.org/wiki/Integer_factorization