惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
博客园 - 【当耐特】
博客园 - 叶小钗
阮一峰的网络日志
阮一峰的网络日志
WordPress大学
WordPress大学
D
Docker
T
The Blog of Author Tim Ferriss
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
月光博客
月光博客
M
MIT News - Artificial intelligence
H
Hackread – Cybersecurity News, Data Breaches, AI and More
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
云风的 BLOG
云风的 BLOG
F
Fortinet All Blogs
罗磊的独立博客
小众软件
小众软件
A
About on SuperTechFans
MyScale Blog
MyScale Blog
D
DataBreaches.Net
The GitHub Blog
The GitHub Blog
C
Check Point Blog
L
LangChain Blog

博客园 - 筱老邪

2026年读书清单,及java技术的巩固 请求处理 图片转为为流的处理 编码和解码 SHA1签名算法,JAVA和C# C#与Java互通AES算法加密解密 .net5读取xml文件 部署linux 踩坑 多线程 .net知识点 下载文件,204问题 debug和release的web.config分开配置 数据库的索引查找 sql 查询出符合条件的表增加字段 HTTP状态码:400\500 错误代码 - 筱老邪 - 博客园 linq 两个list交集差集处理 rabbitMQ的使用 rabbitMQ的部署安装 sql 游标循环
在Java和C#中计算SHA-1哈希
筱老邪 · 2023-07-27 · via 博客园 - 筱老邪

Java版本:

public void testHash() { String password = "Test"; byte[] key = password.getBytes(); MessageDigest md = MessageDigest.getInstance("SHA-1"); byte[] hash = md.digest(key); String result = ""; for ( byte b : hash ) { result += Integer.toHexString(b + 256) + " "; } System.out.println(result); } 

C#版本:

 public void testHash() { String password = "Test"; byte[] key = System.Text.Encoding.Default.GetBytes(password); SHA1 sha1 = SHA1Managed.Create(); byte[] hash = sha1.ComputeHash(key); String result; foreach ( byte b in hash ) { result += Convert.ToInt32(b).ToString("x2") + " "; } Console.WriteLine(result); }