The RFC 1392: Internet Users' Glossary defines "hacker" as:
A person who delights in having an intimate understanding of the internal workings of a system, computers and computer networks in particular.
The term is often misused in a pejorative context, where "cracker" would be the correct term.