Use Android JNI to get an app signature.
Generate your own password based on the signature you get, which prevents others from recompiling their source code and looking for a password.
Jstring java_com_masonsdk_jni_jniutil_getpwd (jnienv* env, Jobject thizz,jobject thiz) {Jclass Native_clazz = env-> Getobjectclass (Thiz); Get the ID of the Getpackagemanager method Jmethodid Methodid_func =env->getmethodid (Native_clazz, "Getpackagemanager", "() Landr Oid/content/pm/packagemanager; "); Get the App Package Manager jobject Package_manager = Env->callobjectmethod (Thiz, Methodid_func); Get Packagemanager class Jclass Pm_clazz = Env->getobjectclass (Package_manager); Get the ID of the Getpackageinfo method Jmethodid methodid_pm = Env->getmethodid (Pm_clazz, "Getpackageinfo", "(Ljava /lang/string;i) landroid/content/pm/packageinfo; "); Get the package name Jmethodid methodid_packagename =env->getmethodid (Native_clazz, "Getpackagename", "() Ljava/lang/String;"); Jstring name_str = static_cast<jstring> (Env->callobjectmethod (Thiz, methodid_packagename)); Get information about the app package Jobject package_info = Env->callobjectmethod (Package_manager, METHODID_PM, NAME_STR, 64);//Env->newstringutf ("COM.EXAMPLE.CONTASDF")//Get PackageInfo class Jclass Pi_clazz = Env->getobjectclass (package_i NFO); Gets the ID of the signature array property Jfieldid Fieldid_signatures = Env->getfieldid (Pi_clazz, "signatures", "[Landroid/content /pm/signature; "); Get signature Array, pending modification jobject Signatur = Env->getobjectfield (Package_info, fieldid_signatures); Jobjectarray signatures = reinterpret_cast<jobjectarray> (Signatur); Get signed Jobject signature = env->getobjectarrayelement (signatures, 0); Get Signature class, pending modification Jclass S_clazz = Env->getobjectclass (Signature); Get the ID of the Hashcode method Jmethodid METHODID_HC = Env->getmethodid (S_clazz, "Hashcode", "() I"); Get the application Package Manager, pending modification int hash_code = Env->callintmethod (signature, METHODID_HC); Char str[100]; sprintf (str, "%u", hash_code); return Env->newstringutf (str);}
Source:
Https://github.com/mentor811/AndroidUltimateEncrypt
"Disclaimer: Copyright, welcome reprint, please do not use for commercial purposes. --SkyTeam "