Hi, i am new in xamarin forms and i want to implement image encryption and decryption. I have java code that do the encryption and decryption for the image and i want to convert it to C# that work in xamarin forms and this is my java code can any one covert it to me please.
package imageencryptanddecrypt;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.File;
import java.security.SecureRandom;
import javax.imageio.ImageIO;
public class ImageEncryptAndDecrypt {
public static void main(String s[]){
String sPath="picture.jpg";
String dPath="picture.jpg";
String password="1234";
StringBuilder sb=new StringBuilder();
char st;
int value;
try{
for (int i = 0; i < password.length(); i++) {
st=password.charAt(i);
value=(int)st;
sb.append(value);
}
SecureRandom sr= SecureRandom.getInstance("SHA1PRNG");
sr.setSeed(sb.toString().getBytes());
BufferedImage FSImg=ImageIO.read(new File(sPath));
for (int w = 0; w < FSImg.getWidth(); w++) {
for (int h = 0; h < FSImg.getHeight(); h++) {
Color color=new Color(FSImg.getRGB(w, h));
Color newColor=new Color(color.getRed()^sr.nextInt(255), color.getGreen()^sr.nextInt(255), color.getBlue()^sr.nextInt(255));
FSImg.setRGB(w, h, newColor.getRGB());
}
}
System.out.println("Process Completed!!..");
ImageIO.write(FSImg, "bmp", new File(dPath));
System.out.println("Wrote to "+dPath);
}catch(Exception e){
e.printStackTrace();}
}
}