MCPcopy Create free account
hub / github.com/Maschell/JNUSTool / localValidDecryptedFileFound

Method localValidDecryptedFileFound

src/de/mas/jnustool/FEntry.java:161–194  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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;

Callers 1

downloadAndDecryptMethod · 0.95

Calls 11

getFullPathMethod · 0.95
getFileLengthMethod · 0.95
isExtractWithHashMethod · 0.95
getHashMethod · 0.95
hashSHA1Method · 0.95
logMethod · 0.95
ByteArrayToStringMethod · 0.95
getNUSTitleMethod · 0.80
equalsMethod · 0.80
getTargetPathMethod · 0.45
getTmdMethod · 0.45

Tested by

no test coverage detected