Need help in converting function of .net to python
Hi All, I hope all of you are doing well in your life. I want to convert this .net function in python private static string decrypt(string enctxt) { string dectext = ""; string encryptKey = "HECT17IPWORI1702"; byte[] encArr = Convert.FromBase64String(enctxt); using (Aes aesObj = Aes.Create()) { Rfc2898DeriveBytes objRfc = new Rfc2898DeriveBytes(encryptKey, new Byte[] { 0x49, 0x76, 0x61, 0x6e, 0x20, 0x4d, 0x65, 0x64, 0x76, 0x65, 0x64, 0x65, 0x76 }); aesObj.Key = objRfc.GetBytes(32); aesObj.IV = objRfc.GetBytes(16); using (MemoryStream ms = new MemoryStream()) { using (CryptoStream cs = new CryptoStream(ms, aesObj.CreateDecryptor(), CryptoStreamMode.Write)) { cs.Write(encArr, 0, encArr.Length); cs.Close(); } dectext = Encoding.Unicode.GetString(ms.ToArray()); } } return dectext; } Please guide me how to convert it into python. Regards Nick
participants (1)
-
NicKz 👫