A black hat is the villain or bad guy, especially in a western movie in which such a character would wear a black hat in contrast to the hero'swhite hat. The phrase is often used figuratively, especially in computing slang, where it refers to a hacker that breaks into networks or computers, or creates computer viruses.[1]
^ (2008) Oxford English Dictionary. Oxford University Press. “black hat n. colloq. (orig. U.S.) (a) a villain or criminal, esp. one in a film or other work of fiction; a ‘bad guy’; (b) Computing slang a person who engages in illegal or malicious hacking, creates or distributes computer viruses, etc.”