當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。