예제 #1
0
        private static string GetSignature(string key, int timestamp, string requestPath)
        {
            // The signature is the SHA1 result of (Timestamp + Route + key) (from http://debrid-link.fr/api_doc/#/home)
            // Timestamp : server unix timestamp
            // Route : path of the request
            // key : key returned by authenticating
            // example Timestamp + Route + key : 1418758917/account/infosi619yOI4Kt8WB02g
            // SHA1 result : ab90fa6a2c9f1bc2bbd7988ff266971b5c10583c
            string signature = timestamp.ToString() + requestPath + key;

            string hash = Crypt.ComputeSHA1Hash(signature).zToHex(lowercase: true);

            //if (__trace)
            //{
            //    pb.Trace.WriteLine("  signature                   : \"{0}\"", signature);
            //    pb.Trace.WriteLine("  signature sha1              : \"{0}\"", hash);
            //}
            return(hash);
        }