根据签名获取hashCode的值

根据签名获取hashCode的值的函数:

int checkAPP(Context context) {
   try {
      PackageInfo packageInfo = context.getPackageManager()
            .getPackageInfo(context.getPackageName(),
                  PackageManager.GET_SIGNATURES);
      Signature[] signs = packageInfo.signatures;
      Signature sign = signs[0];

      int hashcode = sign.hashCode();
      Log.i("test", "hashCode : " + hashcode);
      return hashcode == -82892576 ? 1 : 0;
   } catch (Exception e) {
      e.printStackTrace();
   }
   return -1;
}

你可能感兴趣的:(根据签名获取hashCode的值)