This code is designed to run in the background of the victim’s browser and immediately starts an endless loop of intensive computations at full pace, effectively turning the browser into a hash-crunching mule for the sake of distributed mining of cryptocoins, with profits going directly to the hacker.
Web-based Cryptocurrency Miners on the Rise
Mining via Coin-Hive is primarily meant to generate revenue from time spent on the website as an alternative to advertisements. With an estimated rate of 30 hashes per second for an average desktop computer, generating 1 USD worth of Monero requires approximately 20 days of exposure. Or to put it the other way around: you need roughly 2000 concurrent miners during one minute to generate the same revenue. Coin-Hive’s commission of 30% is already deducted from that amount.
To Block or not to Block, that is the Question
Further reading about cryptominers: