The answer is absolutely illegal. Coinhive is a best example for cryptjacking. Let me first explain you in clear about what Cryptojacking is about, and how to detect and prevent from them. Also this article would discuss about using Coinhive in your website is legit or not.
What’s Cryptojacking :
1) Online mining
2) Memory mining
To learn about, obtaining WiFi credentials, go here : https://stuxnoid.org/how-to-hack-a-wifi/
How Cryptojacking works :
How mining of Crypto currency works :
To learn more about blockchains and cryoto currencies, Go here
Cryptojacking : Legal or Illegal ?
To test whether your device is affected with Cryptojacking or not, Go to cryptojackingtest.com. This website is for providing awareness among public about Cryptojacking by Opera
What will happen to your Adsense account if you use Coinhive :
Obviously, you’ll get your adsense account disabled. Because anything that’s related to crypto currency or blockchain may lead to your adsense account getting banned. Some people around there say, it’s legal to mine Monera which is a type of crypto currency. But sorry incase if you thought so, because this not gonna happen if you have adsense in your website. You can have any other third party ad vendors like revenue hits. They don’t care about backend content or about Cryptojacking. All they need is clicks! But they won’t pay you as high as Adsense and that’s the reason why Google tops the list all these year.