public void ShouldHashInputtedData()
        {
            Hashing hasing = new Hashing();
            var data = "FOOBAR";

            Assert.AreEqual("2E28E57E85DFBC3622830D4FAD1961D9660344B4D3980A751A52270C4B0F83E7844A2A99B2917115051A204DE5AC81F4C4843D78A12983196DDBDD793AAA9369", hasing.Hash(data));
        }
        //Contructor carrying out the main actions for this class
        public Encrypting(Color startColor, string temp_origText, IO curIO, int temp_encryptingNumber)
        {
            if (temp_origText == null || temp_origText.Trim().Length < 1)
            {
                errorMessage = "Please, introduce the string to be encrypted.";
                errors = true;
                return;
            }

            ignoredChars = new List<char>();
            origText = temp_origText;
            modifiedText = origText;
            encryptingNumber = temp_encryptingNumber;

            //Creating the "hash table" (list of colors associated to the characters) has, logically, to be done before starting the encryption.
            //Note that the input string (its length) is also brought into picture while hashing
            curHashing = new Hashing(startColor, this, null, curIO);

            //Performing the actual encryption
            if (!curHashing.errors)
            {
                encryptText(startColor, origText);
            }
            else
            {
                this.errorMessage = curHashing.errorMessage;
                this.errors = true;
            }
        }
        public void TestDecryptUser()
        {
            var userRepo = new UserRepository();

            const string original = "2804900000";
            var user = userRepo.GetUserById(11);
            byte[] key = new Hashing().MD5(user.uname + user.created_timestamp);
            string ssn = Encryption.DecryptString(user.ssn, key);

            Assert.AreEqual(original, ssn);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Hashing newHashing = new Hashing();
            string getUI = newHashing.getUseInput();
            int printInt = newHashing.hash(getUI);
            newHashing.resultingHash(getUI);

            //var awesomeList = new CustomDictionary<string>();

            //{ awesomeList = getUI[printInt]; }
        }
        public bool LoginUser(string userName, string password)
        {
            if (String.IsNullOrEmpty(userName))
                throw new Exception("userName cannot be null or empty");
            if (String.IsNullOrEmpty(password))
                throw new Exception("password cannot be null or empty");

            string hashedPassword = new Hashing().SHA512(password);

            return new UserRepository().ValidateCred(userName, hashedPassword);
        }
        public void TestDecrypt()
        {
            const string original = "Here is some data to encrypt!";
            // Create a new instance of the AesCryptoServiceProvider
            // class.  This generates a new key and initialization vector (IV).
            byte[] key = new Hashing().MD5("Chris09-12-2013 14:12:31");
            byte[] encrypted = Encryption.EncryptString(original, key);

            string roundtrip = Encryption.DecryptString(encrypted, key);

            Assert.AreEqual(original, roundtrip);
        }
 //Constructor with the required "pre-actions" (e.g., hashing) before starting the process
 public Decrypting(Color startColor, Bitmap curBitMap, IO curIO, int temp_encryptingNumber)
 {
     origBitmap = curBitMap;
     encryptingNumber = temp_encryptingNumber;
     curHashing = new Hashing(startColor, null, this, curIO);
     if (!curHashing.errors)
     {
         startDecrypting(curIO);
     }
     else
     {
         errorMessage = curHashing.errorMessage;
         errors = true;
     }
 }
Ejemplo n.º 8
0
 private static string GetHashingPassword(string password)
 {
     var hashing = new Hashing(password);
     return string.Concat(hashing.Salt, hashing.Hash);
 }
Ejemplo n.º 9
0
        //--------------------
        //------------------------------- DECRYPTING
        //Method call soon in the hashing (for decrypting) process: it does not only extract valuable information (start pixel, length and, eventually, offset),
        //but also avoids any wrong image to be analysed further.
        public void getBoundaryPixels(Decrypting curDecrypting, Hashing curHashing)
        {
            Point tempLast = new Point(-1, -1);
            int tempLength = -1;
            int lastLength = 0;
            Color nextPixel = new Color();
            bool storeNext = false;
            curHashing.curLength = -1;

            for (int x = 0; x < curDecrypting.origBitmap.Width; x++)
            {
                for (int y = 0; y < curDecrypting.origBitmap.Height; y++)
                {
                    if (tempLength >= 0) tempLength = tempLength + 1;

                    Color curColor = curDecrypting.origBitmap.GetPixel(x, y);
                    if (storeNext)
                    {
                        //This is the "after pixel" which confirms that an offset actually exists
                        if (!twoColorsAreEqual(curColor, curHashing.startColor))  nextPixel = curColor;
                        storeNext = false;
                    }

                    //StartColor determines where the "relevant chunk" starts/ends, what is done by this condition
                    if (twoColorsAreEqual(curColor, curHashing.startColor))
                    {
                        if (tempLength < 0)
                        {
                            curHashing.startPixel = new Point(x, y);
                            curHashing.startPixelOrig = new Point(x, y);
                            storeNext = true;
                            tempLength = 0;
                        }
                        else
                        {
                            tempLast = new Point(x, y);
                            lastLength = tempLength;
                        }
                    }
                }
            }

            if (tempLast != new Point(-1, -1) && lastLength > 0)
            {
                //The collected information seems right

                curHashing.endPixel = new Point(tempLast.X, tempLast.Y);
                curHashing.curLength = lastLength + 1;

                int afterIndex = curHashing.curIO.allKnownColors.IndexOf(curHashing.startColor) + curDecrypting.encryptingNumber;
                if (afterIndex > curHashing.curIO.allKnownColors.Count - 1) afterIndex = curDecrypting.encryptingNumber;
                Color afterOffset = curHashing.curIO.allKnownColors[afterIndex];

                bool analyseOffset = !nextPixel.IsEmpty && twoColorsAreEqual(afterOffset, nextPixel);

                if (analyseOffset)
                {
                    //There is an offset and thus some variables have to be updated
                    curHashing.curLength = curHashing.curLength - 1; //afterOffset is not included withing the length value
                    curHashing.startOffset.afterOffset = afterOffset;
                    curHashing.startOffset.startOffsetCount = curDecrypting.encryptingNumber;
                    curHashing.startOffset.startPoint = new Point(curHashing.startPixel.X, curHashing.startPixel.Y);
                    curHashing.curLength = curHashing.curLength + curHashing.startOffset.startOffsetCount;
                    curHashing.startPixel = newStartFromOffset(curHashing.startPixel, curHashing.startOffset.startOffsetCount, curDecrypting);
                }

                lengthCorrection(curHashing);
            }
        }
        private void UploadImages()
        {
            new System.Threading.Thread(() =>
                {
                    Hashing hashing = new Hashing();
                    List<string> urls = new List<string>();
                    List<string> links = new List<string>();

                    foreach( string localFile in localFilePaths)
                    {
                        string fileHash = hashing.HashFile(localFile);
                        string extension = System.IO.Path.GetExtension(localFile);

                        urls.Add(webDir + fileHash + extension );
                        links.Add(linkDir + fileHash + extension);
                    }

                    FtpManager ftpManger = new FtpManager();
                    ListingManager listingManager = new ListingManager();
                    ftpManger.OnProgressChange += ftpManger_OnProgressChange;

                    for( int i = 0; i < numberOfImages ; i++)
                    {
                        LoadImage(localFilePaths[i]);
                        UpdateProgress(numberOfImages, i+1);
                        ftpManger.UploadFile(localFilePaths[i], urls[i]);
                        listingManager.AddListingImage(propertyID, links[i], imageCaptions[i]);
                    }

                    CloseForm();
                }).Start();
        }
Ejemplo n.º 11
0
        //Adding pixels with information regarding the length of the string
        private Encrypting addLength(Encrypting curEncrypting, Hashing curHashing, bool analyseOffset)
        {
            string remString = curHashing.curLength.ToString();
            int curIndex = 0;
            if (analyseOffset) curIndex = curEncrypting.encryptingNumber + 1; //AfterOffset has also to be accounted

            //Loop creating one new pixel per digit defining the current length
            while(remString.Trim().Length > 0)
            {
                int curLength = remString.Length;
                curIndex = curIndex + 1;
                char curChar = Convert.ToChar(remString.Substring(0, 1));
                curEncrypting.encryptedString.Insert(curIndex, curHashing.charsVsColors[curChar]);

                if (curLength <= 1) break;
                remString = remString.Substring(1, remString.Length - 1);
            }

            if (analyseOffset)
            {
                //The default population of encryptedString already avoids any pixel before the start one to have startColor. This loop confirms this for all the pixels between
                //the formal start and the actual start (offset)
                if (curEncrypting.encryptingNumber > 0 && curEncrypting.encryptedString.Count >= curEncrypting.encryptingNumber)
                {
                    for (int i = 0; i < curEncrypting.encryptingNumber; i++)
                    {
                        if (twoColorsAreEqual(curEncrypting.encryptedString[i], curHashing.startColor))
                        {
                            //The start point is after this; thus the color of this pixel cannot be the startColor, it will be replaced with the replaceColor
                            curEncrypting.encryptedString[i] = curHashing.replacePair.Value;
                        }
                    }
                }
            }

            return curEncrypting;
        }
Ejemplo n.º 12
0
        public void HashTest()
        {
            string hash = Hashing.HashTypeMaps(TestTypeMaps.P1TypeMap);

            Assert.AreEqual(hash, Hashing.HashTypeMaps(TestTypeMaps.P1TypeMap));
        }
 public override int GetHashCode()
 {
     return(Hashing.CombinedHash(0, typeof(StringParameterValue), _name, _value));
 }
Ejemplo n.º 14
0
 public uint Hash(uint seed)
 {
     Contracts.Check(!IsNA);
     return(Hashing.MurmurHash(seed, _outerBuffer, _ichMin, IchLim));
 }
Ejemplo n.º 15
0
        //Last check performed while hashing (for decryption): the previously-calculated length has to match the value encrypted in some of the pixels of the image in order
        //to confirm that this is a right image and to go ahead with the decryption
        public bool lengthIsOK(Decrypting curDecrypting, Hashing curHashing)
        {
            bool isOK = true;

            curHashing.pixelsLength = new pixelsLengthInfo();

            int count = -1;
            int calcLength = 0;
            string lengthString = "";

            bool firstTime = true;
            bool foundStart = false;

            int startVal = 1;
            if (curHashing.startOffset.startOffsetCount > -1) startVal = startVal + 1; //"After pixel" of the offSet has also to be skipped

            for (int x = 0; x < curDecrypting.origBitmap.Width; x++)
            {
                for (int y = 0; y < curDecrypting.origBitmap.Height; y++)
                {
                    if (firstTime)
                    {
                        x = curHashing.startPixelOrig.X;
                        y = curHashing.startPixelOrig.Y;
                        firstTime = false;
                    }

                    count = count + 1;

                    if (count >= startVal) //to skip startColor and, eventually, offset after pixel
                    {
                        Color curColor = curDecrypting.origBitmap.GetPixel(x, y);
                        KeyValuePair<char, Color> tempPair = curHashing.charsVsColors.FirstOrDefault(x2 => twoColorsAreEqual(x2.Value, curColor));
                        if (Char.IsDigit(tempPair.Key))
                        {
                            curHashing.pixelsToIgnore.Add(new Point(x, y));
                            lengthString = lengthString + tempPair.Key.ToString();
                            if (!foundStart)
                            {
                                curHashing.pixelsLength.startPixel = new Point(x, y);
                                foundStart = true;
                            }
                        }
                        else
                        {
                            return false;
                        }

                        if (int.TryParse(lengthString, out calcLength))
                        {
                            if (calcLength == curHashing.curLength)
                            {
                                curHashing.pixelsLength.length = calcLength;
                                curHashing.pixelsLength.endPixel = new Point(x, y);
                                return true;
                            }
                        }
                        else return false;
                    }
                }
            }

            return isOK;
        }
        public async void Initialize()
        {
            try
            {
                await Nonce.GetNonce();

                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "/api/AnnouncementHalls/GetAnnouncementHallsAnnouncementhAllSubGroupsJOINT");
                var Content = ATISMobileWebApiMClassManagement.GetMobileNumber() + ";" + Hashing.GetSHA256Hash(ATISMobileWebApiMClassManagement.GetApiKey() + Nonce.CurrentNonce);
                request.Content = new StringContent(JsonConvert.SerializeObject(Content), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await HttpClientOnlyInstance.HttpClientInstance().SendAsync(request);

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    var ListAnnouncementHalls = JsonConvert.DeserializeObject <List <KeyValuePair <string, string> > >(content);
                    if (ListAnnouncementHalls.Count == 0)
                    {
                    }
                    else
                    {
                        List <string> Lst = new List <string>();
                        for (int Loopx = 0; Loopx <= ListAnnouncementHalls.Count - 1; Loopx++)
                        {
                            Lst.Add(ListAnnouncementHalls[Loopx].Key + " " + ListAnnouncementHalls[Loopx].Value);
                        }
                        _PickerAnnouncementHallSubGroups.ItemsSource = Lst;
                    }
                }
                else
                {
                    await DisplayAlert("ATISMobile-Failed", JsonConvert.DeserializeObject <string>(response.Content.ReadAsStringAsync().Result), "تایید");
                }
            }
            catch (System.Net.WebException ex)
            { await DisplayAlert("ATISMobile-Error", ATISMobilePredefinedMessages.ATISWebApiNotReachedMessage, "OK"); }
            catch (Exception ex)
            { await DisplayAlert("ATISMobile-Error", ex.Message, "OK"); }
        }
Ejemplo n.º 17
0
        public void SslLikeConversationUseStory()
        {
            // use story: alice send a file (encypted) to bob using run-time generated keys
            //
            // sequence:
            //
            // 1.  alice generated rsa private/public key pair
            // 2.  bob generates rsa private/private key pair
            // 3.  alice generates symmetrical aes key and iv
            // 4.  alice encryptes file with aes symmetric key and iv (3)
            // 5.  alice encrypts aes symmetrical key and iv (3) with bob's public key (2)
            // 6.  alice sends encrypted aes key and iv (5) to bob
            // 7.  alice sends encrypted file (4) to bob
            // 8.  bob decrypts aes key and iv (6) with his private rsa key
            // 9.  bob generates symmetrical key [aes] with decrypted aes key and iv
            // 10. bob decrypts file (7) with aes key (8)
            //

            // 1. 3.
            AesEncryption aliceAes = new AesEncryption();
            RsaEncryption aliceRsa = new RsaEncryption();

            // 2.
            RsaEncryption bobRsa = new RsaEncryption();

            // 4.
            aliceAes.EncryptFile(TestFile, TestFileEncrypted);

            // 5.
            byte[] rsaEncryptedAesKey = aliceRsa.Encrypt(aliceAes.Key, bobRsa.PublicKey);
            byte[] rsaEncryptedAesIV  = aliceRsa.Encrypt(aliceAes.IV, bobRsa.PublicKey);

            // 6. 7.
            // some over aether somehow, usually tcp/ip sockets

            // 8.
            byte[] decryptedAesKey = bobRsa.Decrypt(rsaEncryptedAesKey);
            byte[] decryptedAesIV  = bobRsa.Decrypt(rsaEncryptedAesIV);

            // 9.
            AesEncryption bobAes = new AesEncryption(decryptedAesKey, decryptedAesIV);

            // 10.
            bobAes.DecryptFile(TestFileEncrypted, TestFileDecrypted);

            // assert keys
            Assert.AreNotEqual(Convert.ToBase64String(rsaEncryptedAesKey), Convert.ToBase64String(decryptedAesKey));
            Assert.AreNotEqual(Convert.ToBase64String(rsaEncryptedAesIV), Convert.ToBase64String(decryptedAesIV));

            // assert files
            Hashing h = new Hashing();

            byte[] b     = h.Sha512HashFile(TestFile);
            string hash1 = Convert.ToBase64String(b);

            Console.WriteLine(hash1);

            b = h.Sha512HashFile(TestFileEncrypted);
            string hash2 = Convert.ToBase64String(b);

            Console.WriteLine(hash2);

            b = h.Sha512HashFile(TestFileDecrypted);
            string hash3 = Convert.ToBase64String(b);

            Console.WriteLine(hash3);

            Assert.AreEqual(hash1, hash3);
            Assert.AreNotEqual(hash1, hash2);
        }
Ejemplo n.º 18
0
        private NgramIdFinder GetNgramIdFinder(int iinfo)
        {
            uint mask        = (1U << _exes[iinfo].HashBits) - 1;
            int  ngramLength = _exes[iinfo].NgramLength;
            bool rehash      = _exes[iinfo].Rehash;
            bool ordered     = _exes[iinfo].Ordered;
            bool all         = _exes[iinfo].AllLengths;
            uint seed        = _exes[iinfo].Seed;

            // REVIEW: Consider the case when:
            // * The source key type has count == 2^n, where n is the number of hash bits
            // * rehash == false
            // * ngramLength == 1
            // * ordered == false
            // Then one might expect that this produces the same result as KeyToVector with bagging.
            // However, this shifts everything by one slot, and both the NA values and the original
            // last hash slot get mapped to the first slot.
            // One possible solution:
            // * KeyToVector should have an option to add a slot (the zeroth slot) for NA
            // * NgramHash should, when rehash is false (and perhaps when ordered is false?),
            //   add an extra slot at the beginning for the count of unigram missings.
            // Alternatively, this could drop unigram NA values.

            if (!all && ngramLength > 1)
            {
                if (ordered)
                {
                    // !allLengths, ordered, value of rehash doesn't matter.
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        if (lim < ngramLength)
                        {
                            return -1;
                        }
                        var hash = Hashing.MurmurHash(seed, ngram, 0, lim);
                        if (icol > 0)
                        {
                            hash = Hashing.MurmurRound(hash, (uint)icol);
                        }
                        return (int)(Hashing.MixHash(hash) & mask);
                    });
                }
                else
                {
                    // !allLengths, !ordered, value of rehash doesn't matter.
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        if (lim < ngramLength)
                        {
                            return -1;
                        }
                        return (int)(Hashing.MurmurHash(seed, ngram, 0, lim) & mask);
                    });
                }
            }
            else if (rehash)
            {
                if (ordered)
                {
                    // allLengths, rehash, ordered
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        var hash = Hashing.MurmurHash(seed, ngram, 0, lim);
                        if (icol > 0)
                        {
                            hash = Hashing.MurmurRound(hash, (uint)icol);
                        }
                        return (int)(Hashing.MixHash(hash) & mask);
                    });
                }
                else
                {
                    // allLengths, rehash, !ordered
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        return (int)(Hashing.MurmurHash(seed, ngram, 0, lim) & mask);
                    });
                }
            }
            else if (ngramLength > 1)
            {
                if (ordered)
                {
                    // allLengths, !rehash, ordered
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        uint hash;
                        if (lim == 1)
                        {
                            hash = ngram[0];
                        }
                        else
                        {
                            hash = Hashing.MurmurHash(seed, ngram, 0, lim);
                        }
                        if (icol > 0)
                        {
                            hash = Hashing.MurmurRound(hash, (uint)icol);
                        }
                        return (int)(Hashing.MixHash(hash) & mask);
                    });
                }
                else
                {
                    // allLengths, !rehash, !ordered
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        if (lim == 1)
                        {
                            return (int)(ngram[0] & mask);
                        }
                        return (int)(Hashing.MurmurHash(seed, ngram, 0, lim) & mask);
                    });
                }
            }
            else
            {
                if (ordered)
                {
                    // ngramLength==1, !rehash, ordered
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        uint hash = ngram[0];
                        if (icol > 0)
                        {
                            hash = Hashing.MurmurRound(hash, (uint)icol);
                        }
                        return (int)(Hashing.MixHash(hash) & mask);
                    });
                }
                else
                {
                    // ngramLength==1, !rehash, !ordered
                    return
                        ((uint[] ngram, int lim, int icol, ref bool more) =>
                    {
                        AssertValid(ngram, ngramLength, lim, icol);
                        return (int)(ngram[0] & mask);
                    });
                }
            }
        }
Ejemplo n.º 19
0
 public override int GetHashCode()
 {
     return(Hashing.Hash(this.Signature));
 }
 public SqlStringBasedScriptBase()
 {
     GetHash = () => _cachedHashedContent ?? (_cachedHashedContent = Hashing.CreateHash(Sql));
 }
Ejemplo n.º 21
0
                public void GetCounts(long key, Span <float> counts)
                {
                    var newKey = (long)Hashing.MurmurRound(_mixin, (uint)key);

                    _table.GetCounts(newKey, counts);
                }
Ejemplo n.º 22
0
        public bool SaveUser(User user)
        {
            var role = _securityGroupRepo.GetGroupByTitle(user.sec_group);
            if (role != null)
            {

                var userSec = new security_credentials
                              {
                                  sec_cre_active = user.is_active.TryParseBool(),
                                  sec_cre_timestamp = user.created_timestamp.TryParseDateTime(),
                                  sec_cre_uname = user.uname,
                                  sec_gro_id = role.sec_gro_id,
                                  sec_cre_passwd = new Hashing().SHA512(user.passwd)
                              };
                userSec = _userRepo.InsertSecurityCred(userSec);

                byte[] key = new Hashing().MD5(userSec.sec_cre_uname + userSec.sec_cre_timestamp);
                var userDetails = new user_details
                                  {
                                      usr_det_active = user.is_active.TryParseBool(),
                                      usr_det_email = user.email,
                                      usr_det_fname = user.fname,
                                      usr_det_lname = user.lname,
                                      usr_det_ssn = Encryption.EncryptString(user.ssn.ToString(), key),
                                      usr_det_phoneno = user.phoneno.TryParseInt(),
                                      usr_det_timestamp = user.created_timestamp.TryParseDateTime(),
                                      sec_cre_id = userSec.sec_cre_id
                                  };

                userDetails = _userRepo.InsertDetails(userDetails);

                var city = _cityRepository.GetCity(user.zipcode.TryParseInt());
                var userAddress = new user_address
                                  {
                                      usr_adr_street = user.street,
                                      geo_zip_id = city.geo_zip_id,
                                      usr_det_id = userDetails.usr_det_id
                                  };

                _cityRepository.InsertUserAddress(userAddress);

                new TravelCardLogic().OrderNewCard(user);

                return true;
            }

            return false;
        }
Ejemplo n.º 23
0
 public string HashBytes()
 {
     return(B58C.Encode(Hashing.Generic(HASH_SIZE_BITS, Bytes)));
 }
Ejemplo n.º 24
0
 public int GetHashCode(ulong value)
 {
     return(unchecked ((int)Hashing.Hash(value, 0)));
 }
Ejemplo n.º 25
0
 public override int GetHashCode()
 {
     return(Hashing.Hash(_lastCredentials));
 }
Ejemplo n.º 26
0
 public override int GetHashCode()
 {
     return(Hashing.CombinedHash(Name.GetHashCode(), Signature.GetHashCode()));
 }
Ejemplo n.º 27
0
 public override int GetHashCode()
 {
     return(Hashing.Hash(this.Type, this.Start, this.End));
 }
Ejemplo n.º 28
0
        public bool HasClientConfigurationChanged(long index)
        {
            var actual = Hashing.Combine(_lastClientConfigurationIndex, ServerStore.LastClientConfigurationIndex);

            return(index != actual);
        }
Ejemplo n.º 29
0
 //Correction of the length under very specific conditions: cases "close enough" to get a new digit, that is 10, 11, 100, etc.
 //This has been proven a very serious limitation of the approach (without an accurate length, lots of errors might be provoked),
 //which I might correct in next version by changing the way in which the length is being accounte for
 private void lengthCorrection(Hashing curHashing)
 {
     if (curHashing.curLength >= 10)
     {
         if ((curHashing.curLength - 1).ToString().Length != curHashing.curLength.ToString().Length || (curHashing.curLength - 2).ToString().Length != curHashing.curLength.ToString().Length)
         {
             curHashing.curLength = curHashing.curLength - 1;
         }
     }
 }
Ejemplo n.º 30
0
 public ActionResult <List <Boolean> > getAll()
 {
     return(_context.User.Include(e => e.Login).ToList().Select(e => Hashing.ValidatePassword("Hello", e.Login.Password)).ToList());
 }
Ejemplo n.º 31
0
 public void CalculateHash()
 {
     Hash = Literal == null ? Hash : new FoxHash {
         HashValue = Hashing.HashString(Literal)
     };
 }
        private async void _PickerAnnouncementHallSubGroups_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                await Nonce.GetNonce();

                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "/api/Reports/GetLoadPermissionsIssuedOrderByPriorityReport");
                var Content = ATISMobileWebApiMClassManagement.GetMobileNumber() + ";" + Hashing.GetSHA256Hash(ATISMobileWebApiMClassManagement.GetApiKey() + Nonce.CurrentNonce + _PickerAnnouncementHallSubGroups.SelectedItem.ToString().Split(' ')[0]) + ";" + _PickerAnnouncementHallSubGroups.SelectedItem.ToString().Split(' ')[0];
                request.Content = new StringContent(JsonConvert.SerializeObject(Content), Encoding.UTF8, "application/json");
                HttpResponseMessage response = await HttpClientOnlyInstance.HttpClientInstance().SendAsync(request);

                if (response.IsSuccessStatusCode)
                {
                    var content = await response.Content.ReadAsStringAsync();

                    var Lst = JsonConvert.DeserializeObject <List <Models.PermissionsIssued> >(content);
                    if (Lst.Count == 0)
                    {
                        _ListView.IsVisible = false; _StackLayoutEmptyPermissions.IsVisible = true;
                    }
                    else
                    {
                        _StackLayoutEmptyPermissions.IsVisible = false; _ListView.IsVisible = true; _ListView.ItemsSource = Lst;
                    }
                }
                else
                {
                    await DisplayAlert("ATISMobile-Failed", JsonConvert.DeserializeObject <string>(response.Content.ReadAsStringAsync().Result), "تایید");
                }
            }
            catch (System.Net.WebException ex)
            { await DisplayAlert("ATISMobile-Error", ATISMobilePredefinedMessages.ATISWebApiNotReachedMessage, "OK"); }
            catch (Exception ex)
            { await DisplayAlert("ATISMobile-Error", ex.Message, "OK"); }
        }
Ejemplo n.º 33
0
        // Taken from SongCore
        public static CustomPreviewBeatmapLevel LoadSong(StandardLevelInfoSaveData saveData, string songPath, out string hash, SongFolderEntry folderEntry = null)
        {
            CustomPreviewBeatmapLevel result;
            bool wip = false;

            if (songPath.Contains("CustomWIPLevels"))
            {
                wip = true;
            }
            if (folderEntry != null)
            {
                if (folderEntry.Pack == FolderLevelPack.CustomWIPLevels)
                {
                    wip = true;
                }
                else if (folderEntry.WIP)
                {
                    wip = true;
                }
            }
            hash = Hashing.GetCustomLevelHash(saveData, songPath);
            try
            {
                string folderName = new DirectoryInfo(songPath).Name;
                string levelID    = CustomLevelLoader.kCustomLevelPrefixId + hash;
                if (wip)
                {
                    levelID += " WIP";
                }
                if (SongCore.Collections.hashForLevelID(levelID) != "")
                {
                    levelID += "_" + folderName;
                }
                string            songName                    = saveData.songName;
                string            songSubName                 = saveData.songSubName;
                string            songAuthorName              = saveData.songAuthorName;
                string            levelAuthorName             = saveData.levelAuthorName;
                float             beatsPerMinute              = saveData.beatsPerMinute;
                float             songTimeOffset              = saveData.songTimeOffset;
                float             shuffle                     = saveData.shuffle;
                float             shufflePeriod               = saveData.shufflePeriod;
                float             previewStartTime            = saveData.previewStartTime;
                float             previewDuration             = saveData.previewDuration;
                EnvironmentInfoSO environmentSceneInfo        = _customLevelLoader.LoadEnvironmentInfo(saveData.environmentName, false);
                EnvironmentInfoSO allDirectionEnvironmentInfo = _customLevelLoader.LoadEnvironmentInfo(saveData.allDirectionsEnvironmentName, true);
                List <PreviewDifficultyBeatmapSet> list       = new List <PreviewDifficultyBeatmapSet>();
                foreach (StandardLevelInfoSaveData.DifficultyBeatmapSet difficultyBeatmapSet in saveData.difficultyBeatmapSets)
                {
                    BeatmapCharacteristicSO beatmapCharacteristicBySerializedName = beatmapCharacteristicCollection.GetBeatmapCharacteristicBySerializedName(difficultyBeatmapSet.beatmapCharacteristicName);
                    BeatmapDifficulty[]     array = new BeatmapDifficulty[difficultyBeatmapSet.difficultyBeatmaps.Length];
                    for (int j = 0; j < difficultyBeatmapSet.difficultyBeatmaps.Length; j++)
                    {
                        BeatmapDifficulty beatmapDifficulty;
                        difficultyBeatmapSet.difficultyBeatmaps[j].difficulty.BeatmapDifficultyFromSerializedName(out beatmapDifficulty);
                        array[j] = beatmapDifficulty;
                    }
                    list.Add(new PreviewDifficultyBeatmapSet(beatmapCharacteristicBySerializedName, array));
                }

                result = new CustomPreviewBeatmapLevel(defaultCoverImage.texture, saveData, songPath,
                                                       cachedMediaAsyncLoaderSO, cachedMediaAsyncLoaderSO, levelID, songName, songSubName,
                                                       songAuthorName, levelAuthorName, beatsPerMinute, songTimeOffset, shuffle, shufflePeriod,
                                                       previewStartTime, previewDuration, environmentSceneInfo, allDirectionEnvironmentInfo, list.ToArray());
            }
            catch
            {
                Plugin.log.Error("Failed to Load Song: " + songPath);
                result = null;
            }
            return(result);
        }
Ejemplo n.º 34
0
    protected void registerBtn_Click(object sender, EventArgs e)
    {
        string EncodedResponse = Request.Form["g-recaptcha-response"];

        if (Recaptcha.Validater(EncodedResponse).Equals("True"))
        {
            if (!(pwdRegister.Text.Equals(pwdConfRegister.Text)))
            {
                passwordMatchWarning.Visible = true;
                return;
            }
            if (!(regEmail.Text.Equals(regConfEmail.Text)))
            {
                emailMatchWarning.Visible = true;
                return;
            }
            try
            {
                connection.Open();
            }
            catch (MySqlException ex)
            {
                // Error log
            }
            try
            {
                MySqlCommand cmd        = connection.CreateCommand();
                string       hashedPass = Hashing.HashPassword(pwdRegister.Text);

                cmd.CommandText = "INSERT INTO user_credentials(Email, acc_password, Mobile_No) values (@email_id,@passwd,@mobileNo)";

                cmd.Parameters.AddWithValue("@email_id", regEmail.Text);
                cmd.Parameters.AddWithValue("@passwd", hashedPass);
                cmd.Parameters.AddWithValue("@mobileNo", registerMobile.Text);

                int check = cmd.ExecuteNonQuery();
                if (check > 0)
                {
                    accountCreated.Visible = true;
                }
            }
            catch (MySqlException ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
                if (ex.Number == 1062)
                {
                    emailExistWarning.Visible = true;
                    return;
                }
                else
                {
                    // remove this after testing .....
                    //errorLabel.Text = ex.ToString();
                }
            }
            finally
            {
                if ((connection != null))
                {
                    connection.Close();
                }
            }
        }
        else
        {
            captchaVerification.Visible = true;
        }

        regEmail.Text        = "";
        regConfEmail.Text    = "";
        pwdRegister.Text     = "";
        pwdConfRegister.Text = "";
        registerMobile.Text  = "";
    }
Ejemplo n.º 35
0
        public void Write(Stream output, IDirectory inputDirectory)
        {
            using (Stream inputStream = inputDirectory.ReadFileStream(Hashing.NormalizeFilePath(FilePath)))
                using (Md5Stream md5OutputStream = new Md5Stream(output))
                {
                    long      headerPosition    = output.Position;
                    const int entryHeaderSize   = 32;
                    long      dataStartPosition = headerPosition + entryHeaderSize;
                    output.Position = dataStartPosition;

                    uint uncompressedSize = (uint)inputStream.Length;

                    Stream outputDataStream           = md5OutputStream;
                    Stream outputDataStreamCompressed = null;
                    if (Compressed)
                    {
                        outputDataStreamCompressed = Compression.CompressStream(outputDataStream);
                        outputDataStream           = outputDataStreamCompressed;
                    }

                    if (Encryption != 0)
                    {
                        int encryptionHeaderSize = Cryptography.GetHeaderSize(Encryption);
                        if (encryptionHeaderSize >= 8)
                        {
                            byte[] header = new byte[encryptionHeaderSize];
                            Buffer.BlockCopy(BitConverter.GetBytes(Encryption), 0, header, 0, sizeof(uint));
                            Buffer.BlockCopy(BitConverter.GetBytes(Key), 0, header, 4, sizeof(uint));
                            if (encryptionHeaderSize == 16)
                            {
                                Buffer.BlockCopy(BitConverter.GetBytes(uncompressedSize), 0, header, 8, sizeof(uint));
                                Buffer.BlockCopy(BitConverter.GetBytes(uncompressedSize), 0, header, 12, sizeof(uint));
                            }

                            using (var headerStream = new MemoryStream(header))
                            {
                                headerStream.CopyTo(outputDataStream);
                            }
                        }

                        outputDataStream = new Decrypt2Stream(outputDataStream, (int)uncompressedSize, Key, StreamMode.Write);
                    }

                    inputStream.CopyTo(outputDataStream);
                    outputDataStreamCompressed?.Close();

                    // TODO: HACK to support repacked files
                    if (DataHash == null)
                    {
                        md5OutputStream.Flush();
                        DataHash = md5OutputStream.Hash;
                    }

                    long dataEndPosition = output.Position;
                    uint compressedSize  = (uint)(dataEndPosition - dataStartPosition);
                    uncompressedSize = Compressed ? uncompressedSize : compressedSize;
                    using (var decrypt1Stream = new Decrypt1Stream(output, (int)Version, (int)compressedSize, DataHash, hashLow: (uint)(Hash & 0xFFFFFFFF), streamMode: StreamMode.Write))
                    {
                        CopyTo(output, decrypt1Stream, dataStartPosition, dataEndPosition);
                    }

                    output.Position = headerPosition;

                    const ulong  xorMask1Long = 0x4144104341441043;
                    const uint   xorMask1     = 0x41441043;
                    const uint   xorMask2     = 0x11C22050;
                    const uint   xorMask3     = 0xD05608C3;
                    const uint   xorMask4     = 0x532C7319;
                    BinaryWriter writer       = new BinaryWriter(output, Encoding.ASCII, true);
                    writer.Write(Hash ^ xorMask1Long);
                    writer.Write((Version != 2 ? uncompressedSize : compressedSize) ^ xorMask2);
                    writer.Write((Version != 2 ? compressedSize : uncompressedSize) ^ xorMask3);
                    writer.Write(BitConverter.ToUInt32(DataHash, 0) ^ xorMask4);
                    writer.Write(BitConverter.ToUInt32(DataHash, 4) ^ xorMask1);
                    writer.Write(BitConverter.ToUInt32(DataHash, 8) ^ xorMask1);
                    writer.Write(BitConverter.ToUInt32(DataHash, 12) ^ xorMask2);

                    output.Position = dataEndPosition;
                }
        }
Ejemplo n.º 36
0
 public int GetHashCode(KeyValuePair <int, T> obj)
 {
     return(Hashing.CombineHash(obj.Key, _tComparer.GetHashCode(obj.Value)));
 }
Ejemplo n.º 37
0
        protected int hash(TKey key)
        {
            int h;

            if (typeof(TKey) == typeof(int) || typeof(TKey) == typeof(uint) || typeof(TKey) == typeof(short) || typeof(TKey) == typeof(ushort) || typeof(TKey) == typeof(byte))
            {
                uint k;

                if (typeof(TKey) == typeof(int))
                {
                    k = (uint)(int)(object)key;
                }
                else if (typeof(TKey) == typeof(uint))
                {
                    k = (uint)(object)key;
                }
                else if (typeof(TKey) == typeof(short))
                {
                    k = (uint)(short)(object)key;
                }
                else if (typeof(TKey) == typeof(ushort))
                {
                    k = (ushort)(object)key;
                }
                else
                {
                    k = (byte)(object)key;
                }

                if (k == 0)
                {
                    return(ZEROHASH);
                }

                h = (int)Hashing.Mix(k);
            }
            else if (typeof(TKey) == typeof(long) || typeof(TKey) == typeof(ulong))
            {
                // This is a fast hash 32 bits combiner using the low and high part of the key.
                ulong k;
                if (typeof(TKey) == typeof(long))
                {
                    k = (ulong)(long)(object)key;
                }
                else
                {
                    k = (ulong)(object)key;
                }

                if (k == 0)
                {
                    return(ZEROHASH);
                }

                h = (int)Hashing.Mix(k);
            }
            else
            {
                // We cannot do anything else, resorting to the slow hashing.
                h = _keyComparer.GetHashCode(key);
            }

            // ensure that hash never matches 0, TOMBPRIMEHASH or ZEROHASH
            return(h | REGULAR_HASH_BITS);
        }
Ejemplo n.º 38
0
        private void SeedUsers(LegatoContext context)
        {
            var addGuitar = new UserClaim {
                ClaimName = Constants.Constants.AddGuitarClaim
            };
            var removeGuitar = new UserClaim {
                ClaimName = Constants.Constants.RemoveGuitarClaim
            };
            var editGuitar = new UserClaim {
                ClaimName = Constants.Constants.EditGuitarClaim
            };
            var changeDisplayAmount = new UserClaim {
                ClaimName = Constants.Constants.ChangeDisplayAmountClaim
            };
            var blockUser = new UserClaim {
                ClaimName = Constants.Constants.BlockUserClaim
            };
            var getListOfUsers = new UserClaim {
                ClaimName = Constants.Constants.GetListOfUsersClaim
            };
            var getCompromisedAttempts = new UserClaim {
                ClaimName = Constants.Constants.GetCompromisedAttemptsClaim
            };
            var removeCompromisedAttempts = new UserClaim {
                ClaimName = Constants.Constants.RemoveCompromisedAttemptsClaim
            };

            var user = new UserRole {
                RoleName = "User", UserClaims = new List <UserClaim>()
            };
            var admin = new UserRole {
                RoleName = "Admin", UserClaims = new List <UserClaim> {
                    addGuitar, removeGuitar, editGuitar, blockUser
                }
            };
            var superuser = new UserRole
            {
                RoleName   = "Superuser",
                UserClaims = new List <UserClaim>
                {
                    addGuitar,
                    removeGuitar,
                    editGuitar,
                    blockUser,
                    changeDisplayAmount,
                    getListOfUsers,
                    getCompromisedAttempts,
                    removeCompromisedAttempts
                }
            };

            context.UserClaims.Add(addGuitar);
            context.UserClaims.Add(removeGuitar);
            context.UserClaims.Add(editGuitar);
            context.UserClaims.Add(changeDisplayAmount);
            context.UserClaims.Add(blockUser);
            context.UserClaims.Add(getListOfUsers);
            context.UserClaims.Add(getCompromisedAttempts);
            context.UserClaims.Add(removeCompromisedAttempts);

            context.UserRoles.Add(user);
            context.UserRoles.Add(admin);
            context.UserRoles.Add(superuser);

            string adminPassword     = Hashing.HashData("admin");
            string superuserPassword = Hashing.HashData("superuser");
            string userPassword      = Hashing.HashData("user");

            context.Users.Add(new UserModel {
                Username = "******", EncryptedPassword = adminPassword, IsAuthenticated = false, UserRole = admin
            });
            context.Users.Add(new UserModel {
                Username = "******", EncryptedPassword = superuserPassword, IsAuthenticated = false, UserRole = superuser
            });
            context.Users.Add(new UserModel {
                Username = "******", EncryptedPassword = userPassword, IsAuthenticated = false, UserRole = user
            });

            // seeding fake user data
            for (int i = 0; i < 100; i++)
            {
                string password = Hashing.HashData("qwerty");
                context.Users.Add(new UserModel {
                    Username          = Guid.NewGuid().ToString().Replace("-", string.Empty).Substring(0, 8),
                    EncryptedPassword = password, IsAuthenticated = false, UserRole = user
                });
            }
        }
Ejemplo n.º 39
0
        public MessagesReader(MediaBasedReaderParams readerParams, FormatInfo fmt) :
            base(readerParams.Media, null, null, fmt.ExtensionsInitData, fmt.TextStreamPositioningParams, readerParams.Flags, readerParams.SettingsAccessor)
        {
            if (readerParams.Threads == null)
            {
                throw new ArgumentNullException(nameof(readerParams) + ".Threads");
            }
            this.threads          = readerParams.Threads;
            this.fmtInfo          = fmt;
            this.tempFilesManager = readerParams.TempFilesManager;
            this.trace            = new LJTraceSource("LogSource", string.Format("{0}.r{1:x4}", readerParams.ParentLoggingPrefix, Hashing.GetShortHashCode(this.GetHashCode())));

            base.Extensions.AttachExtensions();

            this.isBodySingleFieldExpression = new Lazy <bool>(() =>
            {
                return(CreateNewFieldsProcessor().IsBodySingleFieldExpression());
            });
        }
Ejemplo n.º 40
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="email"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public bool VerifyUserPassword(string email, string password)
 => Hashing.VerifyPassword(password, _userService.GetUserInfo(email).Password);
Ejemplo n.º 41
0
    public static SongMeta ParseFile(string path, Encoding enc = null)
    {
        using (StreamReader reader = TxtReader.GetFileStreamReader(path, enc))
        {
            bool   finishedHeaders = false;
            string directory       = new FileInfo(path).Directory.FullName;
            string filename        = new FileInfo(path).Name;

            Dictionary <string, string> requiredFields = new Dictionary <string, string> {
                { "artist", null },
                { "bpm", null },
                { "mp3", null },
                { "title", null }
            };
            Dictionary <string, string> voiceNames  = new Dictionary <string, string>();
            Dictionary <string, string> otherFields = new Dictionary <string, string>();

            uint lineNumber = 0;
            while (!finishedHeaders && !reader.EndOfStream)
            {
                ++lineNumber;
                string line = reader.ReadLine();
                if (!line.StartsWith("#", StringComparison.Ordinal))
                {
                    if (lineNumber == 1)
                    {
                        throw new SongMetaBuilderException(path + " does not look like a song file; ignoring");
                    }
                    finishedHeaders = true;
                    break;
                }
                char[]   separator = { ':' };
                string[] parts     = line.Substring(1).Split(separator, 2);
                if (parts.Length < 2 || parts[0].Length < 1 || parts[1].Length < 1)
                {
                    Debug.LogWarning("Invalid line formatting on line " + line + " of file " + path);
                    // Ignore this line. Continue with the next line.
                    continue;
                }
                string tag = parts[0].ToLowerInvariant();
                string val = parts[1];

                if (tag.Equals("encoding", StringComparison.Ordinal))
                {
                    if (val.Equals("UTF8", StringComparison.Ordinal))
                    {
                        val = "UTF-8";
                    }
                    Encoding newEncoding = Encoding.GetEncoding(val);
                    if (!newEncoding.Equals(reader.CurrentEncoding))
                    {
                        reader.Dispose();
                        return(ParseFile(path, newEncoding));
                    }
                }
                else if (requiredFields.ContainsKey(tag))
                {
                    requiredFields[tag] = val;
                }
                else if (tag.Equals("previewstart"))
                {
                    otherFields[tag] = val;
                }
                else if (tag.StartsWith("previewend"))
                {
                    otherFields[tag] = val;
                }
                else if (tag.StartsWith("p", StringComparison.Ordinal) &&
                         tag.Length == 2 &&
                         Char.IsDigit(tag, 1))
                {
                    if (!voiceNames.ContainsKey(tag.ToUpperInvariant()))
                    {
                        voiceNames.Add(tag.ToUpperInvariant(), val);
                    }
                    // silently ignore already set voiceNames
                }
                else if (tag.StartsWith("duetsingerp", StringComparison.Ordinal) &&
                         tag.Length == 12 &&
                         Char.IsDigit(tag, 11))
                {
                    string shorttag = tag.Substring(10).ToUpperInvariant();
                    if (!voiceNames.ContainsKey(shorttag))
                    {
                        voiceNames.Add(shorttag, val);
                    }
                    // silently ignore already set voiceNames
                }
                else
                {
                    if (otherFields.ContainsKey(tag))
                    {
                        throw new SongMetaBuilderException("Cannot set '" + tag + "' twice in file " + path);
                    }
                    otherFields.Add(tag, val);
                }
            }

            // this _should_ get handled by the ArgumentNullException
            // further down below, but that produces really vague
            // messages about a parameter 's' for some reason
            foreach (var item in requiredFields)
            {
                if (item.Value == null)
                {
                    throw new SongMetaBuilderException("Required tag '" + item.Key + "' was not set in file: " + path);
                }
            }

            //Read the song file body
            StringBuilder songBody = new StringBuilder();
            string        bodyLine;
            while ((bodyLine = reader.ReadLine()) != null)
            {
                songBody.Append(bodyLine); //Ignorning the newlines for the hash
            }

            //Hash the song file body
            string songHash = Hashing.Md5(Encoding.UTF8.GetBytes(songBody.ToString()));

            try
            {
                SongMeta res = new SongMeta(
                    directory,
                    filename,
                    songHash,
                    requiredFields["artist"],
                    ConvertToFloat(requiredFields["bpm"]),
                    requiredFields["mp3"],
                    requiredFields["title"],
                    voiceNames,
                    reader.CurrentEncoding
                    );
                foreach (var item in otherFields)
                {
                    switch (item.Key)
                    {
                    case "background":
                        res.Background = item.Value;
                        break;

                    case "cover":
                        res.Cover = item.Value;
                        break;

                    case "edition":
                        res.Edition = item.Value;
                        break;

                    case "end":
                        res.End = ConvertToFloat(item.Value);
                        break;

                    case "gap":
                        res.Gap = ConvertToFloat(item.Value);
                        break;

                    case "genre":
                        res.Genre = item.Value;
                        break;

                    case "language":
                        res.Language = item.Value;
                        break;

                    case "previewstart":
                        res.PreviewStart = ConvertToFloat(item.Value);
                        break;

                    case "previewend":
                        res.PreviewEnd = ConvertToFloat(item.Value);
                        break;

                    case "start":
                        res.Start = ConvertToFloat(item.Value);
                        break;

                    case "video":
                        res.Video = item.Value;
                        break;

                    case "videogap":
                        res.VideoGap = ConvertToFloat(item.Value);
                        break;

                    case "year":
                        res.Year = ConvertToUInt32(item.Value);
                        break;

                    default:
                        res.AddUnkownHeaderEntry(item.Key, item.Value);
                        break;
                    }
                }
                return(res);
            }
            catch (ArgumentNullException e)
            {
                // if you get these with e.ParamName == "s", it's probably one of the non-nullable things (ie, float, uint, etc)
                throw new SongMetaBuilderException("Required tag '" + e.ParamName + "' was not set in file: " + path);
            }
        }
    }
Ejemplo n.º 42
0
 public override int GetHashCode()
 {
     return(Hashing.CombineHash(Height.GetHashCode(), Width.GetHashCode()));
 }
Ejemplo n.º 43
0
 public void CalculateHashes()
 {
     NameHash = Hashing.HashString(Name);
     Container.CalculateHashes();
 }
Ejemplo n.º 44
0
		public ComBypass()
		{
			_hashingProvider = new Hashing();
		}
Ejemplo n.º 45
0
 private string randomHash()
 {
     return(Hashing.Md5(this.random.Next().ToString()));
 }
Ejemplo n.º 46
0
 private static bool VerifyPassword(string password, string userPassword)
 {
     if (string.IsNullOrEmpty(userPassword) || userPassword.Length < 8)
         return false;
     var hashing = new Hashing(userPassword.Substring(0, 8), userPassword.Substring(8));
     return hashing.Verify(password);
 }
Ejemplo n.º 47
0
 private void button6_Click(object sender, EventArgs e)
 {
     Hashing ha = new Hashing();
     ha.Show();
 }