Click here to Skip to main content
15,890,282 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
dear experts ;
i try to create win form project to encrypt some data string , int and date to generate license for my project
i need to decrypt date field to check if license expired or not every login
or if open sours available to generate lic with (customer name , project name , max users ,expiry date and server key ) info it'll be better

What I have tried:

encyrpt code
static string key { get; set; } = "A!9HHhi%XjjYY4YP2@Nob009X";
        public static string Encrypt(string text)
        {
            using (var md5 = new MD5CryptoServiceProvider())
            {
                using (var tdes = new TripleDESCryptoServiceProvider())
                {
                    tdes.Key = md5.ComputeHash(UTF8Encoding.UTF8.GetBytes(key));
                    tdes.Mode = CipherMode.ECB;
                    tdes.Padding = PaddingMode.PKCS7;

                    using (var transform = tdes.CreateEncryptor())
                    {
                        byte[] textBytes = UTF8Encoding.UTF8.GetBytes(text);
                        byte[] bytes = transform.TransformFinalBlock(textBytes, 0, textBytes.Length);
                        return Convert.ToBase64String(bytes, 0, bytes.Length);
                    }
                }
            }
        }
Posted
Updated 10-Sep-18 16:46pm

1 solution

Quote:
Decrypt date using md5

No, it does not exist.
MD5 is not encryption/decryption, it is hashing.
Hashing is a 1 way function, 'unhashing' does not exist.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900