c#中最好的加密和解密算法是什么? [英] Which is the best encryption and decryption algorithm in c#?

查看:35
本文介绍了c#中最好的加密和解密算法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 c# 中使用非常好的加密和解密算法吗?.

I wanna very good encryption and decryption algorithm in c#?.

我用谷歌搜索了一些页面,..我找到了一个,..

I googled Some page,.. I got one,..

 private string base64Encode(string sData)
        {
            try
            {
                byte[] encData_byte = new byte[sData.Length];
                encData_byte = System.Text.Encoding.UTF8.GetBytes(sData);
                string encodedData = Convert.ToBase64String(encData_byte);            
                return encodedData;
            }
            catch (Exception ex)
            {
                throw new Exception("Error in base64Encode" + ex.Message);
            }
        }

  public string base64Decode(string sData)
        {
            System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
            System.Text.Decoder utf8Decode = encoder.GetDecoder();
            byte[] todecode_byte = Convert.FromBase64String(sData);
            int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
            char[] decoded_char = new char[charCount];
            utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
            string result = new String(decoded_char);
            return result;
        }

好用吗?否则建议一个好的.

Is it good?. else suggest a good one.

提前致谢!

推荐答案

第一个编码不是加密.

加密算法的选择将取决于解决方案的要求.没有最好的抽象.

The choice of encryption algorithm will depend on the requirements of solution. There is no abstract best.

您必须考虑所需的保护级别、执行操作所需的时间以及传输密钥的方式.

You must consider the level of protection you require, the time you have to perform the operation and how you will transmit the key.

这篇关于c#中最好的加密和解密算法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆