示例#1
0
        private void EncryptPassword()
        {
            try
            {
                Utils.Hash.Tiger       tiger = new FlowLib.Utils.Hash.Tiger();
                byte[]                 data  = System.Text.Encoding.UTF8.GetBytes(password);
                System.IO.MemoryStream ms    = new System.IO.MemoryStream();
                ms.Write(data, 0, data.Length);
                data = Utils.Convert.Base32.Decode(random);
                ms.Write(data, 0, data.Length);

                data      = tiger.ComputeHash(ms.ToArray());
                encrypted = Utils.Convert.Base32.Encode(data);
            }
            catch { }
        }
示例#2
0
        private void EncryptPassword()
        {
            try
            {
                Utils.Hash.Tiger tiger = new FlowLib.Utils.Hash.Tiger();
                byte[] data = System.Text.Encoding.UTF8.GetBytes(password);
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                ms.Write(data, 0, data.Length);
                data = Utils.Convert.Base32.Decode(random);
                ms.Write(data, 0, data.Length);

                data = tiger.ComputeHash(ms.ToArray());
                encrypted = Utils.Convert.Base32.Encode(data);
            }
            catch { }
        }
示例#3
0
        private void CreateRaw()
        {
            if (info == null)
                return;
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (con is Transfer)
            {
                sb.Append("CINF");
                sb.Append(" ID" + info.Get(UserInfo.CID));
                if (info.ContainsKey("TO"))
                    sb.Append(" TO" + info.Get("TO"));
            }
            else
            {
                sb.Append("BINF " + info.Get(UserInfo.SID));
                // Do PID exist? If not. Create PID and CID
                FlowLib.Utils.Hash.Tiger tiger = new FlowLib.Utils.Hash.Tiger();
                byte[] data = null;
                if (!info.ContainsKey(UserInfo.PID))
                {
                    data = tiger.ComputeHash(System.Text.Encoding.UTF8.GetBytes("FlowLib" + System.DateTime.Now.Ticks.ToString()));
                    info.Set(UserInfo.PID, FlowLib.Utils.Convert.Base32.Encode(data));
                }
                // Make CID from PID. This will always be done.
                data = tiger.ComputeHash(FlowLib.Utils.Convert.Base32.Decode(info.Get(UserInfo.PID)));
                info.Set(UserInfo.CID, FlowLib.Utils.Convert.Base32.Encode(data));

                sb.Append(" ID" + info.Get(UserInfo.CID));
                sb.Append(" PD" + info.Get(UserInfo.PID));
                sb.Append(" DE" + AdcProtocol.ConvertOutgoing(info.Description));

                sb.Append(" HN" + info.TagInfo.Normal.ToString());
                sb.Append(" HO" + info.TagInfo.OP.ToString());
                sb.Append(" HR" + info.TagInfo.Regged.ToString());
                sb.Append(" NI" + AdcProtocol.ConvertOutgoing(info.DisplayName));
                sb.Append(" SL" + info.TagInfo.Slots); // Upload Slots Open
                sb.Append(" SF" + (con.Share != null ? con.Share.HashedCount : 0));  // Shared Files
                sb.Append(" SS" + (con.Share != null ? con.Share.HashedSize : 0));    // Share Size in bytes
                if (con.Share != null)
                {
                    System.Text.StringBuilder support = new System.Text.StringBuilder();
                    switch (info.TagInfo.Mode)
                    {
                        case FlowLib.Enums.ConnectionTypes.Direct:
                        case FlowLib.Enums.ConnectionTypes.UPnP:
                        case FlowLib.Enums.ConnectionTypes.Forward:
                            string ip = info.Get(UserInfo.IP);
                            if (string.IsNullOrEmpty(ip) || ip.Contains("."))
                            {
                                if (string.IsNullOrEmpty(ip))
                                    sb.Append(" I40.0.0.0");
                                else
                                    sb.Append(" I4" + ip);
                                support.Append("TCP4,");    // Support
                                support.Append("UDP4,");    // Support
                                sb.Append(" U4" + con.Share.Port.ToString());
                            }
                            else
                            {
                                sb.Append(" I6" + ip);
                                support.Append("TCP6,");    // Support
                                support.Append("UDP6,");    // Support
                                sb.Append(" U6" + con.Share.Port.ToString());
                            }
                            break;
                    }

                    support.Append("BZIP,");         // Support
                    if (info.ContainsKey(UserInfo.SECURE))
                        support.Append("ADC0,");         // Support
                    sb.Append(" SU" + support.ToString());  // Support
                }
                sb.Append(" VE" + AdcProtocol.ConvertOutgoing(info.TagInfo.Version));
            }
            sb.Append("\n");
            Raw = sb.ToString();
        }
示例#4
0
        private void CreateRaw()
        {
            if (info == null)
            {
                return;
            }
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            if (con is Transfer)
            {
                sb.Append("CINF");
                sb.Append(" ID" + info.Get(UserInfo.CID));
                if (info.ContainsKey("TO"))
                {
                    sb.Append(" TO" + info.Get("TO"));
                }
            }
            else
            {
                sb.Append("BINF " + info.Get(UserInfo.SID));
                // Do PID exist? If not. Create PID and CID
                FlowLib.Utils.Hash.Tiger tiger = new FlowLib.Utils.Hash.Tiger();
                byte[] data = null;
                if (!info.ContainsKey(UserInfo.PID))
                {
                    data = tiger.ComputeHash(System.Text.Encoding.UTF8.GetBytes("FlowLib" + System.DateTime.Now.Ticks.ToString()));
                    info.Set(UserInfo.PID, FlowLib.Utils.Convert.Base32.Encode(data));
                }
                // Make CID from PID. This will always be done.
                data = tiger.ComputeHash(FlowLib.Utils.Convert.Base32.Decode(info.Get(UserInfo.PID)));
                info.Set(UserInfo.CID, FlowLib.Utils.Convert.Base32.Encode(data));

                sb.Append(" ID" + info.Get(UserInfo.CID));
                sb.Append(" PD" + info.Get(UserInfo.PID));
                sb.Append(" DE" + AdcProtocol.ConvertOutgoing(info.Description));

                sb.Append(" HN" + info.TagInfo.Normal.ToString());
                sb.Append(" HO" + info.TagInfo.OP.ToString());
                sb.Append(" HR" + info.TagInfo.Regged.ToString());
                sb.Append(" NI" + AdcProtocol.ConvertOutgoing(info.DisplayName));
                sb.Append(" SL" + info.TagInfo.Slots);                              // Upload Slots Open
                sb.Append(" SF" + (con.Share != null ? con.Share.HashedCount : 0)); // Shared Files
                sb.Append(" SS" + (con.Share != null ? con.Share.HashedSize : 0));  // Share Size in bytes
                if (con.Share != null)
                {
                    System.Text.StringBuilder support = new System.Text.StringBuilder();
                    switch (info.TagInfo.Mode)
                    {
                    case FlowLib.Enums.ConnectionTypes.Direct:
                    case FlowLib.Enums.ConnectionTypes.UPnP:
                    case FlowLib.Enums.ConnectionTypes.Forward:
                        string ip = info.Get(UserInfo.IP);
                        if (string.IsNullOrEmpty(ip) || ip.Contains("."))
                        {
                            if (string.IsNullOrEmpty(ip))
                            {
                                sb.Append(" I40.0.0.0");
                            }
                            else
                            {
                                sb.Append(" I4" + ip);
                            }
                            support.Append("TCP4,");        // Support
                            support.Append("UDP4,");        // Support
                            sb.Append(" U4" + con.Share.Port.ToString());
                        }
                        else
                        {
                            sb.Append(" I6" + ip);
                            support.Append("TCP6,");        // Support
                            support.Append("UDP6,");        // Support
                            sb.Append(" U6" + con.Share.Port.ToString());
                        }
                        break;
                    }

                    support.Append("BZIP,");         // Support
                    if (info.ContainsKey(UserInfo.SECURE))
                    {
                        support.Append("ADC0,");           // Support
                    }
                    sb.Append(" SU" + support.ToString()); // Support
                }
                sb.Append(" VE" + AdcProtocol.ConvertOutgoing(info.TagInfo.Version));
            }
            sb.Append("\n");
            Raw = sb.ToString();
        }