Hi Guys !
i had a problem which i have solved but not sure why it works like this
Import java.io.*; Public class Decrypt{ Public static void main(String[] args){ Try { FileInputStream input= new FileInputStream (new file(“path/filename.enc”)); FileOutputStream output= new FileOutputStream(new File (“path/file2.txt”)); Boolean eof=false; int b=-1; int EncryptedValue=0xD397B428; int mulValue=0x41C64E6D; int addValue=0x3039; input.read(); input.read(); input.read(); input.read(); input.read(); input.read(); input.read(); input.read(); While(!eof){ b=input.read(); if(b==-1){ eof=true; } Else { EncryptedValue=EncryptedValue*mulValue; EncryptedValue=Encrypted+addValue; output.write(b^magicValue); System.out.println(integer.toHexString(b)); } } Output.close(); Input.close(); } Catch(Exception e){ System.out.println(e.getMessage()); } } }
i don't understand why i have to writeeight times to correctly decrypt the file?input.read ();
can anyone explain??
Regards,
Ewa