You will be rewriting this entire file and possibly remove/modify/add a few lines to tweak it to make it work.
We have attached the C# code.
Usually the PHP file will begin with
The other 2 files are for you to compare as you go through this project, the php file will encrypt the file