美文网首页
Facebook秘钥散列获取(正式包)

Facebook秘钥散列获取(正式包)

作者: Dove_iOS | 来源:发表于2022-06-29 21:22 被阅读0次

    新建安装java项目,MainActivity里面替换下面代码,运行搜索KeyHash: 即使正式Facebook秘钥散列

    
    import androidx.appcompat.app.AppCompatActivity;
    import android.content.pm.PackageInfo;
    import android.content.pm.PackageManager;
    import android.content.pm.Signature;
    import android.os.Bundle;
    import android.util.Base64;
    import android.util.Log;
    
    import java.security.MessageDigest;
    import java.security.NoSuchAlgorithmException;
    
    
    public class MainActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            facebookHashKey();
        }
        
        //Facebook秘钥散列获取
        private void facebookHashKey() {
            try {
                PackageInfo info = getPackageManager().getPackageInfo("com.hnqxtech.funwalk", PackageManager.GET_SIGNATURES);
                for (Signature signature : info.signatures) {
                    MessageDigest md = MessageDigest.getInstance("SHA");
                    md.update(signature.toByteArray());
                    Log.d("KeyHash:", Base64.encodeToString(md.digest(), Base64.DEFAULT));
                }
            } catch (PackageManager.NameNotFoundException e) {
            } catch (NoSuchAlgorithmException e) {
            }
        }
    
    }
    
    

    相关文章

      网友评论

          本文标题:Facebook秘钥散列获取(正式包)

          本文链接:https://www.haomeiwen.com/subject/jnsxbrtx.html