is this password check algorithm safe to use in low security environment like local network
static string keys = "qwertyuiopüõasdfghjklöäzxcvbnmQWERTYUIOPÜÄÖLKJHGFDSAZXCVBNM";
static Int64 key = 0;
public static bool check(string input)
{
string tmp = "";
string encAnswer = "ỬốỒởỐỚ";
for (int i = 0; i < input.Length; i++)
{
tmp += keys.IndexOf(input[i]).ToString();
}
key = Int64.Parse(tmp);
string res = "";
char c;
for (int i = 0; i < input.Length; i++)
{
c = input[i];
c = (char)(c ^ key);
res += c;
}
if (res == encAnswer)
return true;
return false;
}
You should stick with hash algorithms, even in low security environments. Take a look on SHA256 Class
Note you will not be able to recover original password by using hash algorithms.
EDIT: As OP noted, just using a hash algorithm isn’t enough. You must to add a salt to make it harder to break. Some examples can be found here: How To: Hash Data with Salt (C#/VB.NET)