c# 0xEF什么意思
答案:5 悬赏:20 手机版
解决时间 2021-03-24 06:54
- 提问者网友:精神病院里
- 2021-03-23 11:55
c# 0xEF什么意思
最佳答案
- 五星知识达人网友:第幾種人
- 2021-03-23 12:56
0xEF表示一个十六进制数,等于十进制数239。
至于这个0xEF,在程序中表示什么,那要看具体的使用场合而定。
若程序将它看作是一个八位的无符号整数,那就是十进制数239;
若程序将它看作是一个八位的有符号整数,那就是十进制数-17;
若程序将它看作是一个布尔量,那就是逻辑值“真”;
若程序将它看作是一个扩展ASCII字符,那就是'ï'(一个汉字在计算机中的存储,通常由二个或更多个扩展ASCII字符或标准ASCII字符组成,依它所采用的编码规则而定,如GB2312-80、BIG5,Unicode,UTF-8等等);
再或者,它是一个大整数的一部分、一个浮点数的一部分、它是一个计算机指令的一部分…………。
至于这个0xEF,在程序中表示什么,那要看具体的使用场合而定。
若程序将它看作是一个八位的无符号整数,那就是十进制数239;
若程序将它看作是一个八位的有符号整数,那就是十进制数-17;
若程序将它看作是一个布尔量,那就是逻辑值“真”;
若程序将它看作是一个扩展ASCII字符,那就是'ï'(一个汉字在计算机中的存储,通常由二个或更多个扩展ASCII字符或标准ASCII字符组成,依它所采用的编码规则而定,如GB2312-80、BIG5,Unicode,UTF-8等等);
再或者,它是一个大整数的一部分、一个浮点数的一部分、它是一个计算机指令的一部分…………。
全部回答
- 1楼网友:旧脸谱
- 2021-03-23 17:03
using System.Web.Security;
using System.Security.Cryptography;
#region 密钥加密
///
/// 得到加密字符串
///
/// 要加密字符串
/// 密钥
///加密后字符串
public string DesEncrypt(string strText, string strEncrKey)//加密函数
{
byte[] byKey=null;
byte[] IV= ;
try
{
byKey = System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0,strEncrKey.Length));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write) ;
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
return Convert.ToBase64String(ms.ToArray());
}
catch(System.Exception error)
{
return "error:" +error.Message+"\r";
}
}
///
/// 得到解密后字符串
///
/// 解密字符串
/// 密钥
///解密后字符串
public string DesDecrypt(string strText,string sDecrKey)//解密函数
{
byte[] byKey = null;
byte[] IV= ;
byte[] inputByteArray = new Byte[strText.Length];
try
{
byKey = System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(0,8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
inputByteArray = Convert.FromBase64String(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
System.Text.Encoding encoding = new System.Text.UTF8Encoding();
return encoding.GetString(ms.ToArray());
}
catch(System.Exception error)
{
return "error:"+error.Message+"\r";
}
}
#endregion
如果对您有帮助,请记得采纳为满意答案,谢谢!祝您生活愉快!
using System.Security.Cryptography;
#region 密钥加密
///
/// 得到加密字符串
///
/// 要加密字符串
/// 密钥
///
public string DesEncrypt(string strText, string strEncrKey)//加密函数
{
byte[] byKey=null;
byte[] IV= ;
try
{
byKey = System.Text.Encoding.UTF8.GetBytes(strEncrKey.Substring(0,strEncrKey.Length));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
byte[] inputByteArray = Encoding.UTF8.GetBytes(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateEncryptor(byKey, IV), CryptoStreamMode.Write) ;
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
return Convert.ToBase64String(ms.ToArray());
}
catch(System.Exception error)
{
return "error:" +error.Message+"\r";
}
}
///
/// 得到解密后字符串
///
/// 解密字符串
/// 密钥
///
public string DesDecrypt(string strText,string sDecrKey)//解密函数
{
byte[] byKey = null;
byte[] IV= ;
byte[] inputByteArray = new Byte[strText.Length];
try
{
byKey = System.Text.Encoding.UTF8.GetBytes(sDecrKey.Substring(0,8));
DESCryptoServiceProvider des = new DESCryptoServiceProvider();
inputByteArray = Convert.FromBase64String(strText);
MemoryStream ms = new MemoryStream();
CryptoStream cs = new CryptoStream(ms, des.CreateDecryptor(byKey, IV), CryptoStreamMode.Write);
cs.Write(inputByteArray, 0, inputByteArray.Length);
cs.FlushFinalBlock();
System.Text.Encoding encoding = new System.Text.UTF8Encoding();
return encoding.GetString(ms.ToArray());
}
catch(System.Exception error)
{
return "error:"+error.Message+"\r";
}
}
#endregion
如果对您有帮助,请记得采纳为满意答案,谢谢!祝您生活愉快!
- 2楼网友:第幾種人
- 2021-03-23 15:37
表示16进制的EF,即10进制的239
- 3楼网友:爱难随人意
- 2021-03-23 14:29
16进制,转换成10进制就是239
- 4楼网友:英雄的欲望
- 2021-03-23 14:09
16进制,换成10进制就是239,换成char就是”ï”
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯