0 Members and 1 Guest are viewing this topic.
Agilent N9340B and N9340C license generatorFor all owners of this Agilent HSA, here is a quick vacation gift (created in less than 1 hour between some pool dives ).The code is C# but should be totally self-explanatory.Code: [Select] private static void calc_license_Agilent_N9340B_C(string hostID, bool is_N9340C) { string[] option = { "PA3", "TG3", "SO3", "DMA", "AMA", "DFS", "KLS", "IBC", "IBF", "INM", "XDM", "BAS", "PAK", "SEM", "SPT", "PWM", "MKT", "U01" }; if (hostID.Length != 8) Console.WriteLine("Error in hostID length!"); for (int m = 0; m < option.Length; m++) { byte[] hash = MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(hostID + option[m] + (is_N9340C ? "DFE" : ""))); Console.Write("{0,-2} {1} ", m, option[m]); for (int i = 0; i < hash.Length; i++) { byte c = 0; for (int j = 0; j < 8; j++) c += (byte)(hash[i] ^ hostID[j]); c = (byte)(c % 36 + 48); if (c > 57) c += 7; Console.Write(Convert.ToChar(c)); } Console.WriteLine(); } }EDIT March 30th, 2023: Added the generation of N9340C family licenses. List of options is here.
private static void calc_license_Agilent_N9340B_C(string hostID, bool is_N9340C) { string[] option = { "PA3", "TG3", "SO3", "DMA", "AMA", "DFS", "KLS", "IBC", "IBF", "INM", "XDM", "BAS", "PAK", "SEM", "SPT", "PWM", "MKT", "U01" }; if (hostID.Length != 8) Console.WriteLine("Error in hostID length!"); for (int m = 0; m < option.Length; m++) { byte[] hash = MD5.Create().ComputeHash(Encoding.ASCII.GetBytes(hostID + option[m] + (is_N9340C ? "DFE" : ""))); Console.Write("{0,-2} {1} ", m, option[m]); for (int i = 0; i < hash.Length; i++) { byte c = 0; for (int j = 0; j < 8; j++) c += (byte)(hash[i] ^ hostID[j]); c = (byte)(c % 36 + 48); if (c > 57) c += 7; Console.Write(Convert.ToChar(c)); } Console.WriteLine(); } }
Do you know if the script can be adapted for the N9320B ?