当前位置:网站首页>App SHA1 acquisition program Baidu map Gaode map simple program for acquiring SHA1 value
App SHA1 acquisition program Baidu map Gaode map simple program for acquiring SHA1 value
2022-06-23 05:52:00 【Muzi 102】
When integrating maps in a project, you often need to go to SHA1 This value is used to configure key The following is a simple acquisition app SHA1 Value program
/** * obtain sha1 * @param context * @return */
public String sHA1(Context context) {
try {
PackageInfo info = context.getPackageManager().getPackageInfo(
context.getPackageName(), PackageManager.GET_SIGNATURES);
byte[] cert = info.signatures[0].toByteArray();
MessageDigest md = MessageDigest.getInstance("SHA1");
byte[] publicKey = md.digest(cert);
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < publicKey.length; i++) {
String appendString = Integer.toHexString(0xFF & publicKey[i])
.toUpperCase(Locale.US);
if (appendString.length() == 1)
hexString.append("0");
hexString.append(appendString);
hexString.append(":");
}
String result = hexString.toString();
return result.substring(0, result.length() - 1);
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
return null;
}边栏推荐
- MySQL面试真题(二十一)——金融-贷款逾期
- Real MySQL interview questions (XXVI) -- didi 2020 written examination questions
- Use of visdom
- Yingjixin ip5566 with type-C port 3A charging and discharging fast charging mobile power supply 5W wireless charging in one SOC
- Wireshark TS | 视频 APP 无法播放问题
- Basic calculator II for leetcode topic analysis
- mysql字符集
- 云原生数据库是未来
- Yingjixin ip6806 wireless charging scheme 5W Qi certified peripheral simplified 14 devices
- PAT 乙等 1009 C语言
猜你喜欢

True MySQL interview question (24) -- row column exchange

Jvm: when a method is overloaded, the specific method to call is determined by the static type of the incoming parameter rather than the actual type of the parameter

Real MySQL interview questions (XXVII) -- Classification of users by RFM analysis method

MySQL面试真题(二十二)——表连接后的条件筛选及分组筛选

jvm-01.指令重排

华为软硬件生态圈成型,从根子上改变美国对软硬件体系的领导地位

How to move the software downloaded from win11 app store to the desktop

Heimdall Database Proxy横向扩展提高20倍

Visdom draws multiple dynamic loss curves

Analysis on the problems and causes of digital transformation of manufacturing industry
随机推荐
TCP/IP 详解(第 2 版) 笔记 / 3 链路层 / 3.4 网桥与交换机
如何指定pig-register项目日志的输出路径
AHA C language Chapter 8 game time is up (lesson 29)
AI艺术的基因工程?使用 #Artbreeder 改变图像的任意形态
啊哈C语言 第7章 有了它你能做更多的事(第27-28讲)
Use of visdom
Centos7部署radius服务-freeradius-3.0.13-15.el7集成mysql
jvm-03.jvm内存模型
Explanation of penetration test process and methodology (Introduction to web security 04)
MySQL面试真题(二十九)——案例-找到爱看的电影
True MySQL interview question (24) -- row column exchange
PAT 乙等 1023 组个最小数
数字藏品到底有什么魔力?目前有哪些靠谱的团队在开发
PAT 乙等 1014 C语言
jvm: 方法重载时,具体调用哪个方法,是由传入参数的静态类型来决定的,而不是由参数的实际类型来决定
MySQL面试真题(二十二)——表连接后的条件筛选及分组筛选
What is the magic of digital collections? Which reliable teams are currently developing
Excel sheet column title for leetcode Title Resolution
Advanced Mathematics (Seventh Edition) Tongji University exercises 1-8 personal solutions
Jvm: when a method is overloaded, the specific method to call is determined by the static type of the incoming parameter rather than the actual type of the parameter