将 Instagram ID 转换为 Url 细分

Convert Instagram Id to Url Segment

目前,我正在尝试将 https://github.com/slang800/instagram-id-to-url-segment 中的 coffee 脚本转换为 C#,但我无法转换,因为我的 coffee 脚本中的 exp 较少。我需要做的很简单,但我无法猜出算法。如果 id 是 1038059720608660215,那么 value 应该是 5n7dDmhTr3。算法的完整代码可在 github.

获得

试试这个

       static void Main(string[] args)
        {
            string[] convert = {
                                 "A","B","C","D","E","F","G","H","I","J",
                                 "K","L","M","N","O","P","Q","R","S","T",
                                 "U","V","W","X","Y","Z","a","b","c","d",
                                 "e","f","g","h","i","j","k","l","m","n",
                                 "o","p","q","r","s","t","u","v","w","x",
                                 "y","z","0","1","2","3","4","5","6","7",
                                 "8","9","-","_"
                             };


            Int64 input = 1038059720608660215;
            string output = "";
            for (int i = 9; i >= 0; i--)
            {
                long digit = (input >> (6 * i)) & 0x3F;
                output += convert[digit];
            }

            Console.WriteLine(output);
            Console.ReadLine();


        }