Navicat.cs 933 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace DecryptPwd.Utils
  7. {
  8. public class Navicat
  9. {
  10. /// <summary>
  11. /// Decrypt Navicat password
  12. /// </summary>
  13. /// <param name="pwd">Encrypted password</param>
  14. /// <returns>Decrypted password</returns>
  15. public static string Decrypt(string pwd)
  16. {
  17. string result = string.Empty;
  18. try
  19. {
  20. byte[] bytes = Convert.FromBase64String(pwd);
  21. for (int i = 0; i < bytes.Length; i++)
  22. {
  23. bytes[i] = (byte)(bytes[i] ^ 0xA3);
  24. }
  25. result = Encoding.UTF8.GetString(bytes);
  26. }
  27. catch (Exception ex)
  28. {
  29. Console.WriteLine(ex.Message);
  30. }
  31. return result;
  32. }
  33. }
  34. }