Wikipedia has a pretty good article on cyclic redundancy checks. It also references some algorithms here.