21
21
import java .io .IOException ;
22
22
import java .io .RandomAccessFile ;
23
23
24
+ import base .MHUtils ;
25
+
24
26
import jpcsp .crypto .CryptoEngine ;
25
27
import keys .GameKeys ;
26
28
27
- public class KirkCypher implements GameKeys {
28
-
29
- static final String HEXES = "0123456789ABCDEF" ;
30
-
31
- private static String getHex (byte [] raw ) {
32
- if (raw == null ) {
33
- return null ;
34
- }
35
- final StringBuilder hex = new StringBuilder (2 * raw .length );
36
- for (final byte b : raw ) {
37
- hex .append (HEXES .charAt ((b & 0xF0 ) >> 4 )).append (HEXES .charAt ((b & 0x0F ))).append (' ' );
38
- }
39
- return hex .toString ();
40
- }
29
+ public class KirkCypher extends MHUtils implements GameKeys {
41
30
42
31
public void decrypt (String file ) {
43
32
try {
@@ -47,11 +36,13 @@ public void decrypt(String file) {
47
36
fd .seek (0 );
48
37
System .out .println ("Decrypting savedata (KIRK engine): " + byte_bt .length + " bytes" );
49
38
System .out .println ("Gamekey: " + getHex (gamekey ));
50
- byte out [] = new CryptoEngine ().DecryptSavedata (byte_bt , byte_bt .length , gamekey , 0 );
39
+ byte hash [] = new byte [0x10 ];
40
+ byte out [] = new CryptoEngine ().DecryptSavedata (byte_bt , byte_bt .length , gamekey , 0 , hash );
51
41
fd .write (out );
52
42
fd .setLength (out .length );
53
43
fd .close ();
54
44
System .out .println ("Finished (" + out .length + " bytes)" );
45
+ System .out .println ("Hash: " + getHex (hash ));
55
46
} catch (FileNotFoundException e ) {
56
47
e .printStackTrace ();
57
48
} catch (IOException e ) {
0 commit comments