得到随机安全码(哈希加密)。
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50/// <summary> /// 得到随机安全码(哈希加密)。 /// </summary> public class HashEncode { public HashEncode() { // // TODO: 在此处添加构造函数逻辑 // } /// <summary> /// 得到随机哈希加密字符串 /// </summary> /// <returns></returns> public static string GetSecurity() { string Security = HashEncoding(GetRandomValue()); return Security; } /// <summary> /// 得到一个随机数值 /// </summary> /// <returns></returns> public static string GetRandomValue() { Random Seed = new Random(); string RandomVaule = Seed.Next(1, int.MaxValue).ToString(); return RandomVaule; } /// <summary> /// 哈希加密一个字符串 /// </summary> /// <param name="Security"></param> /// <returns></returns> public static string HashEncoding(string Security) { byte[] Value; UnicodeEncoding Code = new UnicodeEncoding(); byte[] Message = Code.GetBytes(Security); SHA512Managed Arithmetic = new SHA512Managed(); Value = Arithmetic.ComputeHash(Message); Security = ""; foreach(byte o in Value) { Security += (int) o + "O"; } return Security; } }
posted on
2017-11-24 15:59
高软玩家 阅读(
...) 评论(
...)
编辑
收藏
转载于:https://www.cnblogs.com/qc-id-01/p/7891042.html
最后
以上就是感性花卷最近收集整理的关于得到随机安全码(哈希加密)。的全部内容,更多相关得到随机安全码(哈希加密)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复