Example #1
0
 public static void saveHashes(String path, HashMap<String, String> hashes) {
   if (path.equalsIgnoreCase("")) {
     MLog.e("Can't save Hashes to not given file.");
     return;
   }
   File iFile = new File(path);
   FileOutputStream fos = null;
   ObjectOutputStream oos = null;
   if (!iFile.exists()) {
     MLog.e("Can't save Hashes to not existing file: " + path);
     return;
   }
   if (hashes == null) MLog.w("Writing 'null' to hash database means clearing.");
   try {
     fos = new FileOutputStream(iFile);
     oos = new ObjectOutputStream(fos);
   } catch (FileNotFoundException fnfex) {
     MLog.e("Can't save Hashes to not existing file: " + path);
     return;
   } catch (IOException ioex) {
     MLog.e("Can't create ObjectOutputStream while saving Hashes from " + path);
     return;
   }
   try {
     oos.writeObject(hashes);
   } catch (IOException ioex) {
     MLog.e("Error writing Stream in file: " + path);
     return;
   } // catch (ClassNotFoundException cnfex) { MLog.e("Error writing Stream in file
     // (ClassNotFoundException): " + path); return; }
   MLog.d("Saved Hashmap successfully");
   return;
 }
Example #2
0
 /** Loads all hashes from passwort file */
 public void a() {
   if (loaded) MLog.w("(MAuth) Loading again from Hashmap file... means: Reload without saving!");
   if ((a = MCrypt.loadHashes(b.getAbsolutePath())) == null) a = new HashMap<>();
   // MLog.d("(MAuth) Releasing MAuthorizer.a");
   loaded = true;
 }