中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

C#得到隨機安全碼(哈希加密)的封裝類

2018-07-20    來源:open-open

容器云強勢上線!快速搭建集群,上萬Linux鏡像隨意使用
using System;
using System.Text;
using System.Security.Cryptography;
namespace DotNet.Utilities
{
    /// <summary>
    /// 得到隨機安全碼(哈希加密)。
    /// </summary>
    public class HashEncode
    {
        public HashEncode()
        {
            //
            // TODO: 在此處添加構造函數(shù)邏輯
            //
        }
        /// <summary>
        /// 得到隨機哈希加密字符串
        /// </summary>
        /// <returns></returns>
        public static string GetSecurity()
        {          
            string Security = HashEncoding(GetRandomValue());      
            return Security;
        }
        /// <summary>
        /// 得到一個隨機數(shù)值
        /// </summary>
        /// <returns></returns>
        public static string GetRandomValue()
        {          
            Random Seed = new Random();
            string RandomVaule = Seed.Next(1, int.MaxValue).ToString();
            return RandomVaule;
        }
        /// <summary>
        /// 哈希加密一個字符串,sharejs.com
        /// </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;
        }
    }
}

標簽: 安全

版權申明:本站文章部分自網(wǎng)絡,如有侵權,請聯(lián)系:west999com@outlook.com
特別注意:本站所有轉載文章言論不代表本站觀點!
本站所提供的圖片等素材,版權歸原作者所有,如需使用,請與原作者聯(lián)系。

上一篇:C#獲取漢字字符串的拼音首字母

下一篇:C#封裝類對數(shù)組進行隨機排序