使用C#我试图开发以下两个.我这样做可能有一些问题,需要你的建议.另外,我不知道是否有任何现有的方法来做同样的事情.
private static String HexConverter(System.Drawing.Color c)
{
String rtn = String.Empty;
try
{
rtn = "#" + c.R.ToString("X2") + c.G.ToString("X2") + c.B.ToString("X2");
}
catch (Exception ex)
{
//doing nothing
}
return rtn;
}
private static String RGBConverter(System.Drawing.Color c)
{
String rtn = String.Empty;
try
{
rtn = "RGB(" + c.R.ToString() + "," + c.G.ToString() + "," + c.B.ToString() + ")";
}
catch (Exception ex)
{
//doing nothing
}
return rtn;
}
Run Code Online (Sandbox Code Playgroud)
谢谢.
我在尝试获取哈希字符串时遇到问题c#.
我已经尝试了一些网站,但大多数人都使用文件来获取哈希值.其他用于字符串的东西有点复杂.我找到了像这样的Web身份验证示例:
FormsAuthentication.HashPasswordForStoringInConfigFile(tbxPassword.Text.Trim(), "md5")
Run Code Online (Sandbox Code Playgroud)
我需要使用hash来创建一个包含文件名更安全的字符串.我怎样才能做到这一点?
例:
string file = "username";
string hash = ??????(username);
Run Code Online (Sandbox Code Playgroud)
我应该使用其他哈希算法而不是"md5"吗?
我们写了一个粗略的数据范围.
(我们发现的免费软件终端程序无法跟上蓝牙速度)
结果还可以,我们将它们写入逗号分隔文件,以便与电子表格一起使用.最好看看HexTerateBox中的十六进制值排列在漂亮的列中,而不是它现在的样子(附加屏幕上限).
这是将数字(例如,来自0to的数字FF)添加到RichTextBox中的文本的例程.
public void Write(byte[] b)
{
if (writting)
{
for (int i = 0; i < b.Length; i++)
{
storage[sPlace++] = b[i];
pass += b[i].ToString("X") + " "; //// <<<--- Here is the problem
if (sPlace % numericUpDown1.Value == 0)
{
pass += "\r\n";
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
我想办法为指导pass += b[i].ToString("X") + " ";,以价值观从产生前导零00h到0Fh
或者一些其他的方式把字节值b分为两个字母字符从00到FF

左边的数字FF 40 0 5,排列整齐,整齐,因为它们是相同的.一旦我们遇到任何数据差异,列就会消失,数据变得非常难以通过人类观察来阅读.