zoukankan
html css js c++ java
SHA1 ,MD5 加密
using
System;
using
System.Collections.Generic;
using
System.Text;
using
System.Security.Cryptography;
namespace
Qifan.Common
{
/**/
///
<summary>
///
加密/解密字符串
///
</summary>
public
class
Security
{
/**/
///
<summary>
///
MD5 加密
///
</summary>
///
<param name="passWord">
需要加密的字符串
</param>
///
<returns>
加密后的字符串
</returns>
public
static
string
Md5(
string
passWord)
{
Byte[] clearBytes
=
new
UnicodeEncoding().GetBytes(passWord);
Byte[] hashedBytes
=
((HashAlgorithm)CryptoConfig.CreateFromName(
"
MD5
"
)).ComputeHash(clearBytes);
return
BitConverter.ToString(hashedBytes);
}
/**/
///
<summary>
///
SHA1 加密
///
</summary>
///
<param name="passWord">
需要加密的字符串
</param>
///
<returns>
加密后的字符串
</returns>
public
static
string
Sha1(
string
passWord)
{
Byte[] clearBytes
=
new
UnicodeEncoding().GetBytes(passWord);
Byte[] hashedBytes
=
((HashAlgorithm)CryptoConfig.CreateFromName(
"
SHA1
"
)).ComputeHash(clearBytes);
return
BitConverter.ToString(hashedBytes);
}
}
}
查看全文
相关阅读:
字符串哈希
codeforces#766 D. Mahmoud and a Dictionary (并查集)
莫比乌斯反演模板
马拉车模板
codeforces#580 D. Kefa and Dishes(状压dp)
1076E
448C
543A
295B
poj3974 Palindrome
原文地址:https://www.cnblogs.com/yangbin1005/p/1156996.html
最新文章
记录因webpack版本问题导致vue-cli快速搭建的项目运行时报错!
jqweui 中的tabbar导航
H5中的web worker示例demo分析
meta标签有何作用?一起来学习一下
poj1426(暴力dfs)
hdoj4276(树形dp+分组背包)
hdoj3534(树形dp,求树的直径的条数)
poj3449(判断直线相交)
poj2826(细节,计算几何)
poj3347(扩大数据,避免小数)
热门文章
poj1696(极角排序,贪心)
poj1410(判断线段和矩形是否相交)
(模板)计算几何点线面形基础知识总结
poj1556 The Doors(叉积判断线段相交)
codeforces#983 B. XOR-pyramid (dp)
codeforces#148D. Bag of mice(概率dp)
codeforces#1097 D. Makoto and a Blackboard(dp+期望)
codeforces#687 B. Remainders Game
codeforces#552 D. Vanya and Triangles(几何)
codeforces#1090 D. New Year and the Permutation Concatenation(打表找规律)
Copyright © 2011-2022 走看看