don't panic.
[..]
[ local ]
[ off site ]

Integer
Factorization
Project
The problem of distinguishing prime numbers from composite numbers is ... known
to be one of the most important and useful in arithmetic. ... The dignity of
the science itself seems to require that every possible means be explored for
the solution of a problem so elegant and so celebrated. Gauss
NOTE : most code herein requires either the
Gnu Multiple Precision library
or the Large Integer Package.
Factoring
Algorithms
 Trial Division
 Fermat's Method (difference of squares)
 Pollard's P1
 Pollard's Rho
 Dixon's Method
 Elliptic Curve Method (works, but all the bugs aren't ironed out)
 Quadratic Sieve (requires freeLIP)
References
There are a near infinite number of books that have been written on number
theory, cryptography, and the like. I am only recommending those books with
which I have had prolonged contact; these are the books dealing with number
theory and related disciplines that I am confident are worth their cover price.

Herstein, I.N., Abstract Algebra, 1996.

Koblitz, Neal, Course in Number Theory and Cryptography, 1994.

Kumanduri, Ramanujachary, Number Theory with Computer Applications, 1998.

LeVeque, William, Fundamentals of Number Theory, 1977.
The following papers are also worthwhile. Intractable, but worthwhile.
 CryptoBytes
CryptoBytes is a technical journal published electronically by
RSA Laboratories approximately every quarter. The RSA publications page is
here.
 Parallel Algorithms for Integer Factorization
by Richard Brent. Deals with the potential for distributing implementations
of various factoring schemes.
 The Number Field Sieve
by A.K. Lenstra et al. Description of the algorithm, implementation notes, and
some factorizations obtained thus far.
 Factorization of the Ninth Fermat Number
by A.K. Lenstra et al. Description of how the factorization of F_{9}=
2^{512} + 1 was obtained over the course of four months.
