In order to perform a factory reset of your device, you need to know the security code. The default code is 12345. If you changed it, you need to input the new one in order to perform the reset. There is no other way to do this.
Your mobile phone can be reseted by going to Tools > Settings > General > Factory Settings or by calling to
*#7370#. However, in both cases, the security code is needed.