public string GenerateSessionV1(int partnerId, string adminSecretForSigning, string userId = "", SessionType type = SessionType.USER, int expiry = 86400, string privileges = "") { string ks = string.Format("{0};{0};{1};{2};{3};{4};{5};", partnerId, UnixTimeNow() + expiry, type.GetHashCode(), DateTime.Now.Ticks, userId, privileges); SHA1 sha = new SHA1CryptoServiceProvider(); byte[] ksTextBytes = Encoding.ASCII.GetBytes(adminSecretForSigning + ks); byte[] sha1Bytes = sha.ComputeHash(ksTextBytes); string sha1Hex = ""; foreach (char c in sha1Bytes) { sha1Hex += string.Format("{0:x2}", (int)c); } ks = sha1Hex.ToLower() + "|" + ks; return(EncodeTo64(ks)); }