Guest User

Untitled

a guest
Aug 7th, 2026
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.93 KB | None | 0 0
  1. package com.mishiranu.dashchan.chan.dvach;
  2.  
  3. import android.content.SharedPreferences;
  4. import chan.util.StringUtils;
  5. import com.mishiranu.dashchan.content.MainApplication;
  6. import java.nio.charset.StandardCharsets;
  7. import java.security.GeneralSecurityException;
  8. import java.security.MessageDigest;
  9. import java.util.UUID;
  10.  
  11. /* JADX INFO: compiled from: r8-map-id-69b0d98fa0c655d6ba582ff17a9bb2b718caed2d43ea8140768c75d96d37a9a5 */
  12. /* JADX INFO: loaded from: classes.dex */
  13. final class DvachNoCaptchaInstallIdentity {
  14.     private static final String KEY_APP_BUILD = "app_build";
  15.     private static final String KEY_APP_NAME = "app_name";
  16.     private static final String KEY_APP_VERSION = "app_version";
  17.     private static final String KEY_DEVICE_BRAND = "device_brand";
  18.     private static final String KEY_DEVICE_FINGERPRINT = "device_fingerprint";
  19.     private static final String KEY_DEVICE_MODEL = "device_model";
  20.     private static final String KEY_DEVICE_NAME = "device_name";
  21.     private static final String KEY_SOURCE = "source";
  22.     private static final String KEY_UUID = "uuid";
  23.     private static final String PREFERENCES_NAME = "dvach_no_captcha_identity";
  24.  
  25.     /* JADX INFO: compiled from: r8-map-id-69b0d98fa0c655d6ba582ff17a9bb2b718caed2d43ea8140768c75d96d37a9a5 */
  26.     public static final class Value {
  27.         final String fingerprint;
  28.         final String uuid;
  29.  
  30.         private Value(String str, String str2) {
  31.             this.uuid = str;
  32.             this.fingerprint = str2;
  33.         }
  34.     }
  35.  
  36.     private DvachNoCaptchaInstallIdentity() {
  37.     }
  38.  
  39.     public static synchronized Value get() {
  40.         String string;
  41.         SharedPreferences preferences = getPreferences();
  42.         string = preferences.getString(KEY_UUID, null);
  43.         if (string != null) {
  44.             try {
  45.                 UUID.fromString(string);
  46.             } catch (IllegalArgumentException unused) {
  47.                 string = null;
  48.             }
  49.         }
  50.         if (string == null) {
  51.             string = UUID.randomUUID().toString();
  52.             preferences.edit().putString(KEY_UUID, string).commit();
  53.         }
  54.         return new Value(string, "slooop/beta/" + hash(string));
  55.     }
  56.  
  57.     private static SharedPreferences getPreferences() {
  58.         return MainApplication.getInstance().getSharedPreferences(PREFERENCES_NAME, 0);
  59.     }
  60.  
  61.     public static synchronized DvachNoCaptchaProvisioning.Profile getProfile() {
  62.         SharedPreferences preferences;
  63.         preferences = getPreferences();
  64.         return new DvachNoCaptchaProvisioning.Profile(preferences.getString(KEY_APP_NAME, DvachNoCaptchaProvisioning.DEFAULT_APP_NAME), preferences.getString(KEY_APP_VERSION, "3.2.22-beta1"), preferences.getString(KEY_APP_BUILD, DvachNoCaptchaProvisioning.DEFAULT_APP_BUILD), preferences.getString(KEY_SOURCE, DvachNoCaptchaProvisioning.DEFAULT_SOURCE), preferences.getString(KEY_DEVICE_NAME, DvachNoCaptchaProvisioning.DEFAULT_DEVICE_NAME), preferences.getString(KEY_DEVICE_BRAND, "unknown"), preferences.getString(KEY_DEVICE_MODEL, "unknown"), preferences.getString(KEY_DEVICE_FINGERPRINT, get().fingerprint));
  65.     }
  66.  
  67.     private static String hash(String str) {
  68.         try {
  69.             return StringUtils.formatHex(MessageDigest.getInstance("SHA-256").digest(str.getBytes(StandardCharsets.UTF_8))).substring(0, 24);
  70.         } catch (GeneralSecurityException e) {
  71.             throw new IllegalStateException(e);
  72.         }
  73.     }
  74.  
  75.     public static synchronized boolean putProfile(DvachNoCaptchaProvisioning.Profile profile) {
  76.         return getPreferences().edit().putString(KEY_APP_NAME, profile.appName).putString(KEY_APP_VERSION, profile.appVersion).putString(KEY_APP_BUILD, profile.appBuild).putString(KEY_SOURCE, profile.source).putString(KEY_DEVICE_NAME, profile.deviceName).putString(KEY_DEVICE_BRAND, profile.deviceBrand).putString(KEY_DEVICE_MODEL, profile.deviceModel).putString(KEY_DEVICE_FINGERPRINT, profile.deviceFingerprint).commit();
  77.     }
  78. }
Advertisement
Add Comment
Please, Sign In to add comment