question

AliYlmaz-8572 avatar image
0 Votes"
AliYlmaz-8572 asked AliYlmaz-8572 commented

c# decrypt sha1

Hi,

I am struggling to decrypt users in my nopcommerce project. But when I try to solve it, I get an error. What is the reason for this error? How can i solve it.

Password : 41F954431E47BAF510C98037E7D402979D1BF318

 public virtual string DecryptText(string cipherText, string encryptionPrivateKey = "")
        {
            if (String.IsNullOrEmpty(cipherText))
                return cipherText;
     
            if (String.IsNullOrEmpty(encryptionPrivateKey))
                encryptionPrivateKey = "8346958881167965";
     
            var tDESalg = new TripleDESCryptoServiceProvider();
            tDESalg.Key = Encoding.ASCII.GetBytes(encryptionPrivateKey.Substring(0, 16));
            tDESalg.IV = Encoding.ASCII.GetBytes(encryptionPrivateKey.Substring(8, 8));
     
            byte[] buffer = Convert.FromBase64String(cipherText);
            return DecryptTextFromMemory(buffer, tDESalg.Key, tDESalg.IV);
        }
     
     
        private string DecryptTextFromMemory(byte[] data, byte[] key, byte[] iv)
        {
            using (var ms = new MemoryStream(data))
            {
                using (var cs = new CryptoStream(ms, new TripleDESCryptoServiceProvider().CreateDecryptor(key, iv), CryptoStreamMode.Read))
                {
                    using (var sr = new StreamReader(cs, Encoding.Unicode))
                    {
                        return sr.ReadLine();
                    }
                }
            }
        }
dotnet-csharp
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Paul-5034 avatar image
0 Votes"
Paul-5034 answered

Do you have access to the encryption methods used to generate the password?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

AliYlmaz-8572 avatar image
0 Votes"
AliYlmaz-8572 answered AliYlmaz-8572 commented

Yes i have access to everything. This code is nopcommerce own code.

But I get error "The length of the data to be decrypted is invalid"

I have stated above, I need to decrypt the user passwords in the database.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Nopcommerce hashes the password by default. A hashed password cannot be decrypted.

0 Votes 0 ·

so is there a way to do this? I need to see the passwords

0 Votes 0 ·
Bruce-SqlWork avatar image Bruce-SqlWork AliYlmaz-8572 ·

No.

Hashes by definition are one way and the most common way to store passwords. When the password is saved it’s hashed. At login the login password is hashed and compared to the saved hash.

Note: hashes are not guaranteed to be unique. Two different passwords can have the same hash.

0 Votes 0 ·

Hi,

Well, I need to use these passwords on another site. Because I will migrate user information. The other system also uses SHA 1 but no Salt key.

How is it possible in this case?

0 Votes 0 ·