I have to convert a working C# function to JavaScript so it executes client-side. Here's the C#...
// convert the cmac into a hex number so we can increment it and get the emac
long emacLong = Convert.ToInt64(_cmac, 16) + 1;
emac = emacLong.ToString("x12").ToUpper();
Here's what I have so far in JavaScript..
var emac = parseInt(cmac, 16) + 1;
emac = emac.toString(16);
The input is "0015D1833339". The output should be "0015D183333A". However, the JavaScript returns "15d183333a". I need to retain the leading 0's. Looks like the C# function accomplishes this with the "x12" parameter of .ToString. How do I accomplish this in JavaScript? I need to convert it to an integer, increment it by 1 and then convert back to a string with a length of 12 characters.