当前位置:网站首页>APP SHA1获取程序 百度地图 高德地图获取SHA1值的简单程序
APP SHA1获取程序 百度地图 高德地图获取SHA1值的简单程序
2022-06-23 04:14:00 【木子102】
项目中集成地图的话经常需要到SHA1这个值来配置key 一下是简单的获取app SHA1值的程序
/** * 获取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;
}边栏推荐
- How to move the software downloaded from win11 app store to the desktop
- Yingjixin launched 4 series of lithium batteries 100W mobile power supply voltage rise and fall scheme SOC chip ip5389
- The road of architects starts from "storage selection"
- PAT 乙等 1024 科学记数法 C语言
- fastjson中的@JSONField注解
- Fs2119a Synchronous Boost IC output 3.3V and fs2119b Synchronous Boost IC output 5V
- FS2119A同步升压IC输出3.3V和FS2119B同步升压IC输出5V
- MySQL面试真题(二十九)——案例-找到爱看的电影
- vant weapp日历组件性能优化 Calendar 日历添加min-date最小日期页面加载缓慢
- ORB_SLAM2运行
猜你喜欢

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

数字藏品赋能实体产业释放了哪些利好?

Real MySQL interview question (30) -- shell real estate order analysis

The road of architects starts from "storage selection"

阿里云对象存储oss+picgo+typora实现构建图床
![[opencv450] image subtraction, binarization, threshold segmentation](/img/2c/60d64f3cdcc4ad8f95369d30ad2cdd.png)
[opencv450] image subtraction, binarization, threshold segmentation

What is the magic of digital collections? Which reliable teams are currently developing

Software project management 8.4 Software project quality plan

C primer plus learning notes - 2. Constant and formatted IO (input / output)

基于SSM框架的借阅图书管理系统
随机推荐
MySQL面试真题(二十九)——案例-找到爱看的电影
mysql字符集
Build a gocd environment
visdom的使用
Webrtc[47] - a common way for webrtc to save YUV data
Software design and Development Notes 2: serial port debugging tool based on QT design
Current situation and development of containerization technology under the cloud native trend
June 22, 2022: golang multiple choice question, what does the following golang code output? A:3; B:1; C:4; D: Compilation failed. package main import ( “fmt“ ) func mai
【owt】owt-client-native-p2p-e2e-test vs2017构建 6:修改脚本自动生成vs工程
PAT 乙等 1020.月饼
华为软硬件生态圈成型,从根子上改变美国对软硬件体系的领导地位
C prime plus notes d'apprentissage - 2, constantes et formatage io (I / o)
Leetcode 797: all possible paths
Yingjixin ip6806 wireless charging scheme 5W Qi certified peripheral simplified 14 devices
Oracle异常
1010 Radix
opencv显示图像
抽奖 ddd 代码
数字藏品市场才刚刚开始
常用的无线充发射IC芯片