当前位置: 首页>>代码示例>>C#>>正文


C# String.GetHashCode方法代码示例

本文整理汇总了C#中System.String.GetHashCode方法的典型用法代码示例。如果您正苦于以下问题:C# String.GetHashCode方法的具体用法?C# String.GetHashCode怎么用?C# String.GetHashCode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.String的用法示例。


在下文中一共展示了String.GetHashCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1:

 /// <summary>
 /// Returns a specific Stopwatch if it exists.
 /// </summary>
 /// <param name="identifier">Identifing the used Stopwatch.</param>
 /// <returns>The specified stopwatch.</returns>
 public Stopwatch this[String identifier]
 {
     get
     {
         if (!_stopwatches.ContainsKey(identifier.GetHashCode())) return null;
         return _stopwatches[identifier.GetHashCode()];
     }
     set
     {
         if (value == null) throw new NullReferenceException("Value is null.");
         _stopwatches[identifier.GetHashCode()] = value;
     }
 }
开发者ID:BADF00D,项目名称:Tanpohp,代码行数:18,代码来源:MultiStopwatch.cs

示例2: Activity

 public Activity(String code, String name)
 {
    this.hash = code.GetHashCode();
    this.code = code;
    this.name = name;
    ACTIVITY_POOL.RegisterActivity(this);
 }
开发者ID:Kerbas-ad-astra,项目名称:FinalFrontier,代码行数:7,代码来源:Activity.cs

示例3: rfc4122

 public static string rfc4122(String seed)
 {
     int oldSeed = Random.seed;
       Random.seed = seed.GetHashCode();
       string uuid = rfc4122();
       Random.seed = oldSeed;
       return uuid;
 }
开发者ID:notrubp,项目名称:Platformer,代码行数:8,代码来源:Uuid.cs

示例4: GenerateID

 /// <summary>
 /// generates a unique vactionRequestID
 /// </summary>
 /// <param name="EmployeeID"> the EmployeeID of the creator</param>
 /// <returns>vactionRequestID</returns>
 public ulong GenerateID(String EmployeeID)
 {
     DateTime moment = DateTime.Now;
     long timestamp = moment.Ticks - new DateTime(1970, 1, 1).Ticks;
     long iDHash = EmployeeID.GetHashCode();
     ulong vactionRequestID = (ulong)((timestamp & 0x0000FFFFFFFFFFFF) | (iDHash << 48));
     return vactionRequestID;
 }
开发者ID:timnicolaisen,项目名称:eule,代码行数:13,代码来源:VacationRequestIDGenerator.cs

示例5: StorageKey

        public StorageKey(Guid uid, String key)
        {
            UID = uid;

            UniqueKey = key;

            FragmentID = key.GetHashCode();

        }
开发者ID:NatashaSchutte,项目名称:Warewolf-ESB,代码行数:9,代码来源:StorageKey.cs

示例6: checkPassword

        public static Boolean checkPassword(String password, Int32 passwordHash)
        {
            Boolean ret;

            /* Implement function */
            ret = (passwordHash == password.GetHashCode());
            /* */

            return ret;
        }
开发者ID:csurgotamas,项目名称:Evilstore,代码行数:10,代码来源:PasswordManagementHelper.cs

示例7: generatePasswordHash

        public static Int32 generatePasswordHash(String password)
        {
            Int32 ret;

            /* Implement function */
            ret = password.GetHashCode();
            /* */

            return ret;
        }
开发者ID:csurgotamas,项目名称:Evilstore,代码行数:10,代码来源:PasswordManagementHelper.cs

示例8: getCaptchaFromSiDdos

 private Bitmap getCaptchaFromSiDdos(String domen, String sidDdos)
 {
     string localFilename = Directory.GetCurrentDirectory() + @"\" + sidDdos.GetHashCode() + ".jpg";
     using (WebClient client = new WebClient())
     {
         client.DownloadFile(domen + "agent.php?a=code&sid=" + sidDdos, localFilename);
         Bitmap image = new Bitmap(localFilename);
         return image;
     }
 }
开发者ID:Tauders,项目名称:AutoReg,代码行数:10,代码来源:IntellectBoardReg.cs

示例9: IsExist

 public Boolean IsExist(String fileName)
 {
     if (String.IsNullOrEmpty(fileName) == true) return false;
     int hash = Math.Abs(fileName.GetHashCode());
     hash = hash % 10000;
     int bucket1 = hash / 100;
     int bucket2 = hash % 100;
     String fullPath = Path.Combine(BaseDir, bucket1.ToString(), bucket2.ToString(), fileName);
     return File.Exists(fullPath);
 }
开发者ID:jsonsugar,项目名称:GebCommon,代码行数:10,代码来源:FileStorage.cs

示例10: createPic

        public String createPic(String base64Code, String format)
        {
            try
            {
                //use standard 3 letter suffix
                if (format == "jpeg")
                {
                    format = "jpg";
                }

                //get hash code of this specific image as its file name, ensuring duplicate image won't be created
                String fileName = base64Code.GetHashCode().ToString();
                fileName = fileName + "." + format;

                //generate full path of the image
                String fileFullPath = storePath + "\\" + fileName;

                //if image doesn't exist, create it
                if (!File.Exists(fileFullPath))
                {
                    byte[] arr = Convert.FromBase64String(base64Code);
                    MemoryStream ms = new MemoryStream(arr, 0, arr.Length);
                    ms.Write(arr, 0, arr.Length);
                    Image image = Image.FromStream(ms, true);

                    switch (format)
                    {
                        case "jpg":
                            image.Save(fileFullPath, ImageFormat.Jpeg);
                            break;
                        case "gif":
                            image.Save(fileFullPath, ImageFormat.Gif);
                            break;
                        case "png":
                            image.Save(fileFullPath, ImageFormat.Png);
                            break;
                        case "bmp":
                            image.Save(fileFullPath, ImageFormat.Bmp);
                            break;
                        default:
                            break;
                    }
                    ms.Close();
                }

                //return file name for replacing the original "src" in _resultXML
                return fileName;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error");
                return "Error Happened.";
            }
        }
开发者ID:kurakiyuka,项目名称:KChatForC,代码行数:54,代码来源:PicCreator.cs

示例11: authenticate

        /// <summary>
        /// Function used to authenticate the specified user
        /// </summary>
        /// <param name="userName">user identifier </param>
        /// <param name="password">user password</param>
        /// <returns>User: authenticated, null: not authenticated</returns>
        public User authenticate(String userName, String password)
        {
            User user = null;
            String hashedPassword = password.GetHashCode().ToString("x");
            //validar password

            user = (from u in context.Users
                        where u.UserName == userName
                        && u.Password == hashedPassword
                        select u).FirstOrDefault();

            return user;
        }
开发者ID:hernanUNO6,项目名称:BJA,代码行数:19,代码来源:Rbac.cs

示例12: Build

 public String Build(String[] s)
 {
     if (s[0] != "1" && s[0] != "2" && s[0] != "3" && s[0] != "4" && s[0] != "5" && s[0] != "6" )
     {
         throw new ArgumentException("Protokolltyp " + s[0] + "in param[0] ist nicht definiert!");
     }
     String ret = "";
     for (int i = 0; i < s.Length; i++)
     {
         ret += s[i] + "@@@";
     }
     ret += s.GetHashCode();
     return ret;
 }
开发者ID:DODO-Connect,项目名称:DODO-Messenger,代码行数:14,代码来源:MessageBuilder.cs

示例13: insertUser

        //public Boolean isAuthorized(String userName, String permissionName)
        //{
        //}
        public void insertUser(String userName, String completeName , String password, long userID )
        {
            var newUser = new User();

            newUser.Id = (int)IdentifierGenerator.NewId();
            newUser.IdSession = SessionManager.getSessionIdentifier();
            newUser.UserName = userName;
            newUser.CompleteName = completeName;
            newUser.Password = password.GetHashCode().ToString("x");
            newUser.IdUserRelation = userID;

            context.Users.Add(newUser);

            context.SaveChanges();
        }
开发者ID:hernanUNO6,项目名称:BJA,代码行数:18,代码来源:Rbac.cs

示例14: Resolve

        public void Resolve(String name, bool ip4Only)
        {
            this.m_name = name;

            int hash = name.GetHashCode();
            if (hash < 0)
                hash = -hash;
            hash = hash % 55536;
            hash += 10000;

            try {
                Address = new IPEndPoint(IPAddress.Loopback, hash);
            } catch (Exception ex) {
                throw new ArgumentException("",ex);
            }
        }
开发者ID:oskarwkarlsson,项目名称:netmq,代码行数:16,代码来源:IpcAddress.cs

示例15: ConnectionKey

        public ConnectionKey(String username, String password)
        {
            this.username = username;
            this.password = password;

            this.hash = 31;
            if (!String.IsNullOrEmpty(username))
            {
                hash += username.GetHashCode();
            }

            hash *= 31;
            if (!String.IsNullOrEmpty(password))
            {
                hash += password.GetHashCode();
            }
        }
开发者ID:tabish121,项目名称:NMS.Pooled,代码行数:17,代码来源:ConnectionKey.cs


注:本文中的System.String.GetHashCode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。