Tag Archives: sha256
How to hash a string with salt using a multi-algorithm method
It is considered a very bad idea to store user credentials in plain text, especially passwords. For that very reason it is always a good idea to hash passwords before you store them, ideally with a unique salt that you can store in another location. That way if for whatever reason your database is compromised your users passwords will not be in plain text and it will require a bit of work in order to find out what each password is, especially if the salt for each password is stored somewhere else.
The following method is a multi algorithm method, that means that with this single method you can use more than one algorithm to hash your data. The snippet below shows an example how to hash your data with a single method using seven different algorithms.
Our main method that will do all the work for us:
1 2 3 4 5 6 | private string StringToHash(string data, string salt, HashAlgorithm algorithm) { byte[] saltedBytes = Encoding.UTF8.GetBytes(data + salt); // Combine the data with the salt byte[] hashedBytes = algorithm.ComputeHash(saltedBytes); // Compute the hash value of our input return BitConverter.ToString(hashedBytes); } |
TextCrypt Suite Online now available
Since I had some spare free time and had fun playing with CSS, Ajax and PHP creating TextPlay Online, I decided to make an online version of TextCrypt Suite as well.
The current version supports 17 algorithms and 27 methods for encrypting and decrypting text. I will be adding more in the near future.
You can access it by using the top navigation bar or by simply clicking this link: TextCrypt Suite Online.
Posted in Website News.
Tagged base64, binary, crc32, encode url, escape, fluxbytes, hex, md2, md4, md5, ripemd, sha1, sha256, sha384, sha512, text decryption, text encryption, unescape