Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
myBB密码c#客户端_C# - Fatal编程技术网

myBB密码c#客户端

myBB密码c#客户端,c#,C#,我正在使用一个加载器/客户端,我的论坛用户将使用他们的myBB信息登录到我的应用程序。我知道在应用程序中使用数据库连接是不好的。但是我也要将他们的hwid存储在数据库中,所以我无论如何都需要连接到它 但是,它们存储的密码如下所示: $hashedpsw = md5(md5($salt).md5($plainpassword)); string salt = "D4UFUd6U"; // get salt from db string password = "test!";// get pass

我正在使用一个加载器/客户端,我的论坛用户将使用他们的myBB信息登录到我的应用程序。我知道在应用程序中使用数据库连接是不好的。但是我也要将他们的hwid存储在数据库中,所以我无论如何都需要连接到它

但是,它们存储的密码如下所示:

$hashedpsw = md5(md5($salt).md5($plainpassword));
string salt = "D4UFUd6U"; // get salt from db
string password = "test!";// get password from user
MD5 md5 = new MD5CryptoServiceProvider();

// Create md5 hash of salt
byte[] saltBytes = Encoding.Default.GetBytes(salt);
byte[] saltHashBytes = md5.ComputeHash(salt);
string saltHash = System.BitConverter.ToString(saltHashBytes);

// Create your md5(password + md5(salt)) hash
byte[] passwordBytes = Encoding.Default.GetBytes(password + saltHash);
byte[] passwordHashBytes = md5.ComputeHash(salt);
string passwordHash = BitConverter.ToString(passwordHashBytes);
我尝试重新创建的密码如下所示:

$hashedpsw = md5(md5($salt).md5($plainpassword));
string salt = "D4UFUd6U"; // get salt from db
string password = "test!";// get password from user
MD5 md5 = new MD5CryptoServiceProvider();

// Create md5 hash of salt
byte[] saltBytes = Encoding.Default.GetBytes(salt);
byte[] saltHashBytes = md5.ComputeHash(salt);
string saltHash = System.BitConverter.ToString(saltHashBytes);

// Create your md5(password + md5(salt)) hash
byte[] passwordBytes = Encoding.Default.GetBytes(password + saltHash);
byte[] passwordHashBytes = md5.ComputeHash(salt);
string passwordHash = BitConverter.ToString(passwordHashBytes);
但我得到了以下错误:

无法从“字符串”转换为“System.IO.Stream”

需要一个
IO.Stream
Byte[]
作为输入,并且正如错误指定的那样,无法将字符串隐式转换为
IO.Stream

以下是如何将字符串转换为流(从中窃取)的示例:

这会将您的代码更改为以下内容:

string salt = "D4UFUd6U"; // get salt from db
string password = "test!";// get password from user
MD5 md5 = new MD5CryptoServiceProvider();

// Create md5 hash of salt
byte[] saltBytes = Encoding.Default.GetBytes(salt);
byte[] saltHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    salteHashBytes = md5.ComputeHash(saltStream);
}
string saltHash = System.BitConverter.ToString(saltHashBytes);

// Create your md5(password + md5(salt)) hash
byte[] passwordBytes = Encoding.Default.GetBytes(password + saltHash);
byte[] passwordHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    passwordHashBytes = md5.ComputeHash(saltStream);
}
string passwordHash = BitConverter.ToString(passwordHashBytes);
需要一个
IO.Stream
Byte[]
作为输入,并且正如错误指定的那样,无法将字符串隐式转换为
IO.Stream

以下是如何将字符串转换为流(从中窃取)的示例:

这会将您的代码更改为以下内容:

string salt = "D4UFUd6U"; // get salt from db
string password = "test!";// get password from user
MD5 md5 = new MD5CryptoServiceProvider();

// Create md5 hash of salt
byte[] saltBytes = Encoding.Default.GetBytes(salt);
byte[] saltHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    salteHashBytes = md5.ComputeHash(saltStream);
}
string saltHash = System.BitConverter.ToString(saltHashBytes);

// Create your md5(password + md5(salt)) hash
byte[] passwordBytes = Encoding.Default.GetBytes(password + saltHash);
byte[] passwordHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    passwordHashBytes = md5.ComputeHash(saltStream);
}
string passwordHash = BitConverter.ToString(passwordHashBytes);
需要一个
IO.Stream
Byte[]
作为输入,并且正如错误指定的那样,无法将字符串隐式转换为
IO.Stream

以下是如何将字符串转换为流(从中窃取)的示例:

这会将您的代码更改为以下内容:

string salt = "D4UFUd6U"; // get salt from db
string password = "test!";// get password from user
MD5 md5 = new MD5CryptoServiceProvider();

// Create md5 hash of salt
byte[] saltBytes = Encoding.Default.GetBytes(salt);
byte[] saltHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    salteHashBytes = md5.ComputeHash(saltStream);
}
string saltHash = System.BitConverter.ToString(saltHashBytes);

// Create your md5(password + md5(salt)) hash
byte[] passwordBytes = Encoding.Default.GetBytes(password + saltHash);
byte[] passwordHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    passwordHashBytes = md5.ComputeHash(saltStream);
}
string passwordHash = BitConverter.ToString(passwordHashBytes);
需要一个
IO.Stream
Byte[]
作为输入,并且正如错误指定的那样,无法将字符串隐式转换为
IO.Stream

以下是如何将字符串转换为流(从中窃取)的示例:

这会将您的代码更改为以下内容:

string salt = "D4UFUd6U"; // get salt from db
string password = "test!";// get password from user
MD5 md5 = new MD5CryptoServiceProvider();

// Create md5 hash of salt
byte[] saltBytes = Encoding.Default.GetBytes(salt);
byte[] saltHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    salteHashBytes = md5.ComputeHash(saltStream);
}
string saltHash = System.BitConverter.ToString(saltHashBytes);

// Create your md5(password + md5(salt)) hash
byte[] passwordBytes = Encoding.Default.GetBytes(password + saltHash);
byte[] passwordHashBytes;
using( Stream saltStream = GenerateStreamFromString(salt))
{
    passwordHashBytes = md5.ComputeHash(saltStream);
}
string passwordHash = BitConverter.ToString(passwordHashBytes);

您可以使用
MD5CryptoServiceProvider
类使用
md5
哈希算法进行加密。首先添加以下名称空间:

using System.Text;
using System.Security.Cryptography;
第二,尝试这样的函数

public static string Encrypt(string content)
{
   MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
   byte[] bytes = Encoding.ASCII.GetBytes(content);
   bytes = md5.ComputeHash(data);
   string result = Encoding.ASCII.GetString(bytes);
   return result;
}

您可以使用
MD5CryptoServiceProvider
类使用
md5
哈希算法进行加密。首先添加以下名称空间:

using System.Text;
using System.Security.Cryptography;
第二,尝试这样的函数

public static string Encrypt(string content)
{
   MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
   byte[] bytes = Encoding.ASCII.GetBytes(content);
   bytes = md5.ComputeHash(data);
   string result = Encoding.ASCII.GetString(bytes);
   return result;
}

您可以使用
MD5CryptoServiceProvider
类使用
md5
哈希算法进行加密。首先添加以下名称空间:

using System.Text;
using System.Security.Cryptography;
第二,尝试这样的函数

public static string Encrypt(string content)
{
   MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
   byte[] bytes = Encoding.ASCII.GetBytes(content);
   bytes = md5.ComputeHash(data);
   string result = Encoding.ASCII.GetString(bytes);
   return result;
}

您可以使用
MD5CryptoServiceProvider
类使用
md5
哈希算法进行加密。首先添加以下名称空间:

using System.Text;
using System.Security.Cryptography;
第二,尝试这样的函数

public static string Encrypt(string content)
{
   MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
   byte[] bytes = Encoding.ASCII.GetBytes(content);
   bytes = md5.ComputeHash(data);
   string result = Encoding.ASCII.GetString(bytes);
   return result;
}


哪一行出现错误?byte[]saltHashBytes=md5.ComputeHash(salt);`和
byte[]passwordHashBytes=md5.ComputeHash(salt)在哪一行出现错误?byte[]saltHashBytes=md5.ComputeHash(salt);`和
byte[]passwordHashBytes=md5.ComputeHash(salt)在哪一行出现错误?byte[]saltHashBytes=md5.ComputeHash(salt);`和
byte[]passwordHashBytes=md5.ComputeHash(salt)在哪一行出现错误?byte[]saltHashBytes=md5.ComputeHash(salt);`和
byte[]passwordHashBytes=md5.ComputeHash(salt)每当您使用流时,总是建议您将其包装在using语句中,以便在使用完流后正确关闭它,即使引发异常也是如此。字节[]saltHashBytes;使用(Stream saltStream=GenerateStreamFromString(salt)){saltHashBytes=md5.ComputeHash(saltStream);}编辑。但是,在将*HashBytes数组变量传递到BitConverter.ToString()方法之前,我没有输入代码来检查它是否为null。您至少需要给读取器留下一些练习:)无论何时使用流,始终建议您将其包装在using语句中,以便在完成后正确关闭它,即使引发异常也是如此。字节[]saltHashBytes;使用(Stream saltStream=GenerateStreamFromString(salt)){saltHashBytes=md5.ComputeHash(saltStream);}编辑。但是,在将*HashBytes数组变量传递到BitConverter.ToString()方法之前,我没有输入代码来检查它是否为null。您至少需要给读取器留下一些练习:)无论何时使用流,始终建议您将其包装在using语句中,以便在完成后正确关闭它,即使引发异常也是如此。字节[]saltHashBytes;使用(Stream saltStream=GenerateStreamFromString(salt)){saltHashBytes=md5.ComputeHash(saltStream);}编辑。但是,在将*HashBytes数组变量传递到BitConverter.ToString()方法之前,我没有输入代码来检查它是否为null。您至少需要给读取器留下一些练习:)无论何时使用流,始终建议您将其包装在using语句中,以便在完成后正确关闭它,即使引发异常也是如此。字节[]saltHashBytes;使用(Stream saltStream=GenerateStreamFromString(salt)){saltHashBytes=md5.ComputeHash(saltStream);}编辑。但是,在将*HashBytes数组变量传递到BitConverter.ToString()方法之前,我没有输入代码来检查它是否为null。您至少需要给读取器留下一些练习:)