• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Site with Unity interface

Newbie Spellweaver
Joined
Apr 4, 2023
Messages
40
Reaction score
19
I'm creating a website for AION using Unity. The idea is to do something like the GameForge interface. But what I need to know here is what method (or if someone can give me the ready code) to encrypt the password to save it in the database?
 
Newbie Spellweaver
Joined
Apr 4, 2023
Messages
40
Reaction score
19
base64(sha1(password))
Maybe I didn't know how to write the code correctly, because the result is being different for the password generated in theclient and the one generated by my application.
hashcod - Site with Unity interface - RaGEZONE Forums


my code:
C#:
private string ConvertToBase64(string input)
{
    byte[] inputBytes = Encoding.UTF8.GetBytes(input);
    string base64String = Convert.ToBase64String(inputBytes);
    return base64String;
}     
static string ConvertToSha1(string input)
{
    byte[] inputBytes = Encoding.UTF8.GetBytes(input);
    byte[] hashBytes;
    using (SHA1 sha1 = SHA1.Create())
    {
        hashBytes = sha1.ComputeHash(inputBytes);
    }
    string hashString = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();     
    return hashString;
}
 

Attachments

You must be registered for see attachments list
Last edited:
Upvote 0
Junior Spellweaver
Joined
Mar 2, 2023
Messages
196
Reaction score
326
Maybe I didn't know how to write the code correctly, because the result is being different for the password generated in theclient and the one generated by my application.
View attachment 174149

my code:
C#:
private string ConvertToBase64(string input)
{
    byte[] inputBytes = Encoding.UTF8.GetBytes(input);
    string base64String = Convert.ToBase64String(inputBytes);
    return base64String;
}    
static string ConvertToSha1(string input)
{
    byte[] inputBytes = Encoding.UTF8.GetBytes(input);
    byte[] hashBytes;
    using (SHA1 sha1 = SHA1.Create())
    {
        hashBytes = sha1.ComputeHash(inputBytes);
    }
    string hashString = BitConverter.ToString(hashBytes).Replace("-", "").ToLower();    
    return hashString;
}


Code:
public static string Base64Encode(string plainText)
{
  var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
  return System.Convert.ToBase64String(plainTextBytes);
}
 
Upvote 0
Newbie Spellweaver
Joined
Apr 4, 2023
Messages
40
Reaction score
19
Code:
public static string Base64Encode(string plainText)
{
  var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
  return System.Convert.ToBase64String(plainTextBytes);
}

Thank you so much for your help!
And in case anyone else is interested in the code, I did it (see code below) and it worked perfectly.

C#:
static string EncodedString(string input)
{
    byte[] inputBytes = Encoding.UTF8.GetBytes(input);
    byte[] hashBytes;
    using (SHA1 sha1 = SHA1.Create())
    {
        hashBytes = sha1.ComputeHash(inputBytes);
    }
    return Convert.ToBase64String(hashBytes);
}

Hello everyone!
Look at my website project with Unity WebGl. I posted on Github and maybe that's why it's not accessing the database (it should be a Github protection) but here at home it accesses the virtual machine and works properly.

 
Last edited:
Upvote 0
Back
Top