Controlled electrochemical dissolution of hydrothermal and sedimentary pyrite