コード例 #1
0
        public void AddData(string login, string password)
        {
            string salt = Hashing.GetSalt();

            try
            {
                hashMap.AddHash(Hashing.GetHash(login), new Account(login, Hashing.GetShaHash(password + salt), salt));
            }
            catch (OverflowException)
            {
                hashMap.Serealize(nowFileName);
                nowFileName = $@"{PathData}\file{Directory.GetFiles(PathData, $"*.{fileDataType}").Length}.{fileDataType}";
                hashMap.AddHash(Hashing.GetHash(login), new Account(login, Hashing.GetShaHash(password + salt), salt));
                throw new OverflowException();
            }
        }
コード例 #2
0
        public static HashMap <Account> HashUser(int count)
        {
            HashMap <Account> hashMap = new HashMap <Account>();

            Account account;

            for (int i = 1; i <= count; i++)
            {
                string salt = Hashing.GetSalt();
                uint[] arr  = Hashing.GetShaHash(i.ToString() + salt);

                account = new Account(i.ToString(), arr, salt);
                hashMap.AddHash(Hashing.GetHash(account.Login), account);
            }

            hashMap.Serealize("HashData/file1.data");

            Debug.WriteLine("Hashing end");

            return(hashMap);
        }