Black-hat hackers violate computer security for personal gain or maliciousness, such as stealing credit card numbers or conducting DDOS attacks. White-hat hackers are ethical hackers who compromise security systems for legal and ethical purposes to help improve security. Gray-hat hackers fall between black and white hats as they may technically commit crimes or act unethically but not for personal gain or to cause harm.