Yahoo has said that all of its three billion user accounts were affected in a hacking attack dating back to 2013.