How to factory reset locked Iphone 5?

I shouldn't have done this but I bought an I phone 5 off the street from a shady swap meat. It seems pretty evident now the phone wasn't legitimately acquired on the sellers part. The phone came as is included with USB cable. No instruction manual or box at all. The phone is locked with a password too. Can I make some use from this phone or did I waste my money?

I don't think you can make use of it… You wasted your $