The present invention generally relates to the use of diphenyliodonium salts for lowering sulfide concentrations and for preventing growth of microbes in a water injection system, a hydrocarbon extraction system, or a hydrocarbon production system. Treating oilfield injection and produced fluids containing high levels of microbes with diphenyliodonium salts can significantly decrease the amount of hydrogen sulfide produced, which can be used to measure sulfidogenesis. The treatment can also decrease the number of microbes in the injection and produced fluids. Thus, these diphenyliodonium salts can be effectively used as inhibitors of hydrogen sulfide generation and as biocides in oilfield fluids.