Dictionary.com
Thesaurus.com

white hat vs. black hat

[hwahyt hat, wahyt] / ˈʰwaɪt ˈhæt, ˈwaɪt /

noun

Informal.
  1. a virtuous hero, especially in a cowboy movie; good guy.

  2. Also called white hat hackerComputers. a hacker who violates the security of a system with the knowledge and consent of the owner or developer in order to test the code, without malicious intent.

[blak hat] / ˈblæk ˈhæt /

noun

Informal.
  1. a villain, as in a cowboy movie; bad guy.

  2. Also called black hat hackerComputers. a hacker who violates the security of a system without the knowledge or consent of the owner or developer, as for personal profit or for the gratification of causing damage.

idioms

  1. wear / put on a black hat, to behave villainously.