()
| 159 | } |
| 160 | |
| 161 | public boolean localValidDecryptedFileFound(){ |
| 162 | boolean result = false; |
| 163 | File f = new File(fst.getTmd().getNUSTitle().getTargetPath() + getFullPath()); |
| 164 | if(f.exists()){ |
| 165 | if(f.length() == getFileLength()){ |
| 166 | result = true; |
| 167 | if(Settings.deepHashCheck){ |
| 168 | byte[] fileHash = null; |
| 169 | String [] path = getFullPath().split("/"); |
| 170 | if(!path[1].equals("code") && isExtractWithHash()){ |
| 171 | fileHash = Arrays.copyOfRange(getHash(),0,0x14); //Little cheat at already hash files. |
| 172 | }else{ |
| 173 | fileHash = HashUtil.hashSHA1(f, 0x8000); |
| 174 | } |
| 175 | |
| 176 | byte[] expectedHash = Arrays.copyOfRange(getHash(), 0, 0x14); |
| 177 | if(Arrays.equals(fileHash, expectedHash)){ |
| 178 | result = true; |
| 179 | }else{ |
| 180 | Logger.log(this.fileName + ": decrypted file is invalid. Hash mismatch"); |
| 181 | Logger.log(this.fileName + " Hash:" + Util.ByteArrayToString(fileHash)); |
| 182 | Logger.log(this.fileName + " Excpected: " + Util.ByteArrayToString(expectedHash)); |
| 183 | result = false; |
| 184 | } |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | if(result){ |
| 189 | Logger.log("Skipping: " + String.format("%8.2f MB ",getFileLength()/1024.0/1024.0) + getFullPath()); |
| 190 | return result; |
| 191 | } |
| 192 | } |
| 193 | return result; |
| 194 | } |
| 195 | |
| 196 | public boolean localValidEncryptedFileFound() throws IOException{ |
| 197 | boolean result = false; |
no test coverage detected