Click here to Skip to main content
15,884,628 members
Everything / Hash

Hash

hash

Great Reads

by Marc Clifton
An interactive demo of how audit and consistency proofs work
by Bruno van Dooren
This article describes a way to hash data using the latest Win32 API and C++
by phil.o
C# implementation of sponge construction and SHA-3 hashing operations
by Vasil Trifonov
Compare two DLL files programmatically using hash

Latest Articles

by Bruno van Dooren
This article describes a way to hash data using the latest Win32 API and C++
by honey the codewitch
Get your data on, even on platforms without a reliable STL implementation using these simple but critical classes.
by Sanmayce
Brutally optimized hash function for general table lookups
by DiponRoy
Create hash and compare

All Articles

Sort by Score

Hash 

13 Mar 2017 by Marc Clifton
An interactive demo of how audit and consistency proofs work
26 Aug 2022 by Bruno van Dooren
This article describes a way to hash data using the latest Win32 API and C++
29 Jan 2018 by phil.o
C# implementation of sponge construction and SHA-3 hashing operations
20 Feb 2013 by Sergey Alexandrovich Kryukov
Rehash? I hope that some appropriate cryptographic hash function was used. It makes it cryptographically infeasible to restore the password from the hash function; this is the whole point of such functions:http://en.wikipedia.org/wiki/Cryptographic_hash_function[^].Even if we could restore...
3 Dec 2012 by Vasil Trifonov
Compare two DLL files programmatically using hash
20 Feb 2013 by OriginalGriff
If you mean "Can we tell what was hashed to produce this?" then the answer is "no". Hashes are designed to be one-way - you cannot regenerate the original input from teh hashed value.
7 May 2013 by Rion Williams
Generating an MD5 hash from a string using LINQ.
14 Mar 2014 by CPallini
In this CodeProject article you may find: "Hash Functions: An Empirical Comparison"[^].
21 Apr 2014 by Zoltán Zörgő
"Forgor password" functionality does not mean sending old plain text password to the user. Not at all. Actually this is the most vulnerable point in an application, since you have no control over what's happening. Generating one-time-password and sending that one to the user and forcing the user...
13 Sep 2012 by OriginalGriff
Your problem is that you are treating the data as text - it isn't. It is hex data, ie 128 bytes of binary data displayed on the wiki page as hex digits. You are holding it (and reading it) as 256 text characters (with or without line breaks) which will produce completely different hash values...
24 Apr 2014 by thatraja
Check theseBeginners guide to a secure way of storing passwords[^]&Password Security[^]The Art & Science of Storing Passwords[^]
2 Jun 2014 by Keith Barrow
If you follow your original link[^], go to the "Methods" section and click "Create()" you are taken to the information about the Create method: here[^].The page states "By default, this overload uses the SHA1CryptoServiceProvider ", so the default provider is SHA-1[^].
23 Jan 2015 by Zoltán Zörgő
This one works:import java.security.MessageDigest;import java.security.Security;import java.security.NoSuchAlgorithmException;import java.io.UnsupportedEncodingException;public class HelloWorld{ public static String ConvertToHash(String password) { try { MessageDigest...
23 Jan 2015 by Sergey Alexandrovich Kryukov
Please see my comment to the question: don't use MD5! For example, you can use SHA-256 through the class java.security.MessageDigest:http://docs.oracle.com/javase/7/docs/api/java/security/MessageDigest.html[^].—SA
22 Dec 2015 by Richard MacCutchan
I already gave you a suggestion yesterday in your original of this question[^].
7 May 2016 by OriginalGriff
Read the filename from your textbox:string path = txtFilePath.Text;Check the file exists:if (!File.Exists(path)) { ... report problem to user. return; }Then just call your method:txtHashValue.Text = MD5HashFile(path);Simple enough, yes?
1 Jun 2018 by Member 13737597
This article shows how Windows generates IP header's ID field
24 Mar 2020 by CPallini
Quote: how can I programmatically convert this Each character (say c) of the input string represent a nibble. The value of the nibble is given by if ( c >= '0' && c ='a' && c
26 Oct 2011 by Pascal Ganaye
Provides a couple of hash functions (string to int) that will return the same value in C# and T-SQL
28 Mar 2012 by Kschuler
Code Master123 wrote:I have looked all over and found nothing on GoogleWhat did you search for? Because I googled[^] and found all kinds of downloads for classes that are supposed to do the LM hash. I also found This link[^] that posts code directly. And a good explaination on...
2 May 2012 by Sergey Alexandrovich Kryukov
The question is not really correct. First, the criterion "most secure" can not be strictly defined. Moreover, suppose you have some secure algorithm, without a flaw like a backdoor, which can use different hash sizes, a hash sizes being a parameter. You can always make it more "secure" by...
6 Mar 2014 by phil.o
Simply: Public Function fnEncrypedValue(ByVal value) Dim sSourceData As String = value 'Create a byte array from source data. Dim tmpSource As Byte() = ASCIIEncoding.ASCII.GetBytes(sSourceData) 'Compute hash based on source data. Dim...
14 Mar 2014 by OriginalGriff
Loads!Lower security is nearly always faster, but you will have to do some timing tests yourself.Of you aren't interested in security, then there are loads of ways to hash stuff: MD5, CRC, even XOR and SUM.What you want too use will depend on your data, and how big your hash has to...
21 Apr 2014 by Manas Bhardwaj
Well, my suggestion would be not to implement the Forgot Password by sending their password as plain text in email.I would rather extend Forgot Password as Reset Password. Thus, if you forget your password you are forced to reset your password.And this is standard and more secure...
19 Dec 2014 by OriginalGriff
Try not converting it to a char array - send teh string directly:string password = HashPassword(tbxPassword.Text);cmd.Parameters.AddWithValue("@HashedPassword", password);Normally, I work with binary data for hashes, but since your BCryptHelper.HashPassword method is returning a string,...
13 Jan 2015 by OriginalGriff
We do not condone, support or assist in the production of malicious code in any way, form or manner. This is a professional site for professional developers. The fact that you downloaded the file from a torrent site is in breach of copyright, which is a malicious (and in most countries...
22 Nov 2016 by Jochen Arndt
Please don't post external links to images. You only have a few lines of code and an error message that can be posted here.If you had done that I would be able to copy and paste the code into my answer showing you how to solve the problem. But so you will only get a textual answer.The...
3 Dec 2016 by CPallini
Assuming it is not homework, you should use std::unordered_map[^].
30 Aug 2017 by OriginalGriff
Quote: If the file is being used by another process, would this cause an issue? Well ... this code: On Error GoTo ErrorHandler ... ErrorHandler: Return False Would mean that if the file was in use, it would return false - so anything which means it can't complete the task would...
6 Jun 2018 by OriginalGriff
Oh gawd... Quote: When a new program opens, my program scans that newly opened program, and if it's MD5 exists in a locally hosted database, a dialogue called Detect.vb should come up saying "Virus detected". That isn;t going to work, not even slightly. MD5 is a hashing code, which produces a...
24 Sep 2018 by Peter_in_2780
From "man nano", the section NOTES: In some cases nano will try to dump the buffer into an emergency file. This will happen mainly if nano receives a SIGHUP or SIGTERM or runs out of memory. It will write the buffer into a file named nano.save if the buffer didn't have a name ...
11 Oct 2018 by Patrice T
Quote: Segmentation fault with big array size. Why ? Because memory is not infinite, the memory model used with your C compiler have a limit, and the OS also give a limited share of memory if you don't tell the OS that you need more. For more details, you need to tell us : - What is your C...
19 Feb 2019 by Mehdi Gholam
If you need to check for the existence or lack there of something in a list and you don't have the memory capacity or it is infeasible to store use Bloom filter - Wikipedia[^] . Bloom filters will give you a definite negative if it is not encoded in the bloom bits, and a probable positive for...
19 Jul 2019 by Richard Deeming
If you're encrypting the user's password, then you're doing it wrong. You should only ever store a salted hash of the password, using multiple rounds of a cryptographically secure one-way hashing algorithm. Secure Password Authentication Explained Simply[^] Salted Password Hashing - Doing it...
20 Mar 2020 by phil.o
const unsigned char* rawdata = "046EAF0968AA895ADDFEE599566F0B880242461D1377F4887C9B84631E13067B96DB18C41E0C208F8D12EBCC3F99F2522903AF6105833E4CBADE9D6A1D0F039187"; You've already been told that, but I am going to tell you once more: the rawdata...
24 Mar 2020 by OriginalGriff
How many times are you going to ask the same question? Starting again under a new user doesn't disguise it : go back to the last two times you asked this question (or even the last eight!) and try doing it for yourself instead of expecting others...
27 Mar 2020 by Richard MacCutchan
OK, this is what it is: Base58Check encoding - Bitcoin Wiki[^]
11 Apr 2020 by OriginalGriff
You can't reverse hashing functions: they are not a form of encryption. That's why hashes are always the same length regardless of the input length: they throw away information in order to generate a (hopefully) unique value from the input. ...
29 Mar 2021 by Richard Deeming
I'm no expert, but your C code seems to be generating an HMAC[^], whereas your PHP code is just generating a raw un-keyed hash. Your PHP code would need to use hash_hmac[^] with the same secret key to generate the same result.
5 Jun 2021 by OriginalGriff
Compiling does not mean your code is right! :laugh: Think of the development process as writing an email: compiling successfully means that you wrote the email in the right language - English, rather than German for example - not that the email...
10 Feb 2022 by Tony Hill
Try this HashAlgorithm myHashAlgorithm = HashAlgorithm.Create("SHA512"); byte[] hash = myHashAlgorithm.ComputeHash(Encoding.UTF8.GetBytes(PIN_Entry.Text)); string MyHash = System.BitConverter.ToString(hash); ...
10 Feb 2022 by M Imran Ansari
In order to use a non-static field, method, or property, you must first create an object of an instance. HashAlgorithm hashAlgo = HashAlgorithm.Create("SHA512"); Now use the object hashAlgo to call their methods. Reference for more information:...
11 Jan 2012 by zhanghong317
How to make a key fuzzy lookup the hash table, not Traversal. eg: word 'EA' lookup Key 'EAS','EAGGG' etc. in the hash
11 Jan 2012 by Andrew Rissing
To start off, I'll have to admit I've never tried something like this, but I think I can direct you a bit. If you have a Hashtable (or even a Dictionary), they store values on a 1:1 basis (i.e. one key, one value).So, the only way to approach this problem as you've stated it without...
17 Feb 2012 by suunker
Hey, I'm trying to implement a pretty cool feature that will make it possible for users to upload photos from iPhone to Safari(see more on http://picupapp.com/[^] . I've also been reading instructions on how to implement it on this blog:...
28 Mar 2012 by Code Master38
I was wondering is there a way to calculate the old LM hashes for windows in .net? I have looked all over and found nothing on Google, however I found Ophcrack generates them and I'm wondering how?I have to find a way to generate them as a homework assignment, so any help would be nice!
2 May 2012 by Anele Ngqandu
Hi HuysWhat is the most secure hashing algorithm used?
17 Jun 2012 by Giggsey73
Hi guys. I am just wondering how it is possible to create two new colliding md5 executable files? In other words, both files have the same hash values.Appreciate it. Thanks.
17 Jun 2012 by Richard MacCutchan
By experimentation, or by ensuring that the content of both is the same. Since MD5 hashes are one-way you cannot predict what the result of hashing any content is likely to be.
18 Jul 2012 by lewax00
So then what's the problem? Any reason you can't use Dictionary[^] or Hashtable[^]? As far as I know, you can use .Net objects in PowerShell.
23 Jul 2012 by graybin
PS > $hash = @{}PS > $hash['class1'] = @('student1')PS > $hash['class1'] += 'student2'PS > $hashName Value---- -----class1 {student1, student2}
6 Aug 2012 by lewax00
First, there's no reason hashing a dummy file would be unsafe, nor would it be impractical for testing purposes. As for the difference in time, it's hard to say. If the hashing algorithm changes it's behavior based on the contents of the file (e.g. if the last bit of a block is 0 do A, if...
23 Aug 2012 by StianSandberg
I ran into a discussion with one of the programmers at my office. Is there any limitations for how much data you can hash? There's a lot of different algorithms for hashing, but we use SHA-1 and SHA-2Can I hash (in theory) a value of 100 gigabyte? or 1 petabyte?
23 Aug 2012 by StianSandberg
A little more googling and I found the answer.The maximum input size = (2length − 1) bits. For example, the maximum input size of SHA-1 = (264 − 1).SHA-384 and SHA-512 has a maximum input size of (2128 - 1)ref: http://en.wikipedia.org/wiki/Comparison_of_cryptographic_hash_functions[^]
13 Nov 2012 by Sergey Alexandrovich Kryukov
This is nothing but standard URI "fragment identifier": http://en.wikipedia.org/wiki/Fragment_identifier[^].So, there is nothing specific to gmail or facebook. One little twist is the combination with the index file naming schema, which creates the URLs of the form...
23 Dec 2012 by Richard MacCutchan
You already posted this question here[^]. Please post in one forum only.
23 Dec 2012 by TorstenH.
You do not mean encode / decode. What you are thinking about is encryption / decryption.PGP is the no1 choice for that, there is a private key for encryption and a matching, public key for decryption.Check this:...
27 Feb 2013 by Sergey Alexandrovich Kryukov
Rehash? I hope that some appropriate cryptographic hash function was used. It makes it cryptographically infeasible to restore the password from the hash function; this is the whole point of such functions:http://en.wikipedia.org/wiki/Cryptographic_hash_function[^].Even if we could restore...
2 Apr 2013 by AdiCivils
I'm creating a HashMap. While creating it, I can see that keys are assigned proper distinct values, but, after creation, when I iterate it, all the keys are yielding only one value. Below is my code: public void prepareAccountMap(HashMap masterMap, GAReadConfigType config,...
27 Jun 2013 by coder-project-name
I have a DB where I am not allowed to change the schema and the tables do not have last mod time in them. I need to query this DB data daily and check if there are any rows that changed. I thought combining the columns and hashing it with one of the columns also as key of hash, and write the...
30 Oct 2013 by Buddhi Chaturanga
Firstly,I want to inform you that my overall/main target is to execute certain functions using their function name(string) as an argument,I defined a function as below: (I want to generate a unique number for each string data that I inserted as argument to a function).#include ...
30 Oct 2013 by Aescleal
Try using std::map first. Yep, the performance is rubbish but often you can't tell the difference between optimal and rubbish when you've got a small number of things (less than thousands) to choose between. Another thing you might want to try is std::unordered_map as you can then write portable...
6 Mar 2014 by atul sharma 5126
Hello,I am trying to convert the password into hash value to further save and then match it for login. But while coding itself the above error is showing. This is my first time at hashing. Thanks in advance.error is at line: Dim tmpSource As Byte =...
21 Apr 2014 by Muhammad Taqi Hassan Bukhari
I am working on my web project. I want to store user password the secure way like hashing, but i came to know that after the password is hashed it cannot be converted back. But in My project i have To implement Forgot password and reset password. Reset Password is OK but when the case of forget...
21 Apr 2014 by DamithSL
Generates a random password, assigns it to the user account, sends an email informing the user of their new password- http://www.asp.net/web-forms/tutorials/security/admin/recovering-and-changing-passwords-cs[^]-...
24 Apr 2014 by Muhammad Taqi Hassan Bukhari
I have created a Web Login Form For User Signup and Login. First i found that to securely store password in database, i should use hash and salt on .net pages. Then i came to know that there is a function in sql server Hash-bytes that also hashes the password, where i can store the plain...
19 May 2014 by Jörgen Andersson
The classic function in C# to create a hash value from an array looks like this or similar:public int GetHashCode(T[] array) { unchecked { if (array == null) { return 0; } int hash = 17; ...
19 May 2014 by CPallini
Couldn't you just declare hash as Int64 and clear the upper part when needed?
20 May 2014 by Jörgen Andersson
For future reference, this is how my solution looks like: Public Overrides Function GetHashCode() As Integer Dim hash As Int64 = 19 For Each Item As T In Me hash = hash * 31 + Item.GetHashCode hash = ((hash > 32) + hash >>...
23 Aug 2014 by demoninside9
Hi All,I am saving hash password and sal password in db.But when I trying to retrieve password, the password doesn't match. why. below is my code.Creating Userprotected void Create_User() { try { string salt = GenerateSalt(); ...
23 Aug 2014 by OriginalGriff
Start by checking your GenerateSalt method, and make sure it returns the same thing as the code in Do_Login does. Any slight difference here will mean wildly different values.
23 Jan 2015 by Salah Abualrob
Hi all, i implemented this code to hash user password, but when i try to hash the same password again, it generates another hash!this is my code:public static String ConvertToHash(String password) { try { MessageDigest ms = MessageDigest.getInstance("MD5"); byte[] pass =...
25 Apr 2015 by HeinrichRichardSonButt
I am trying to generate the HMAC SHA1 Hash to use the Railway PNR API[^].I am using PHP Framework Codeigniter.I used the helper given here.Then I tried to generate the hash and compare it with the Hash Generator[^] given in the Rail PNR API site.But both the hash i.e. the one I generated...
25 Apr 2015 by HeinrichRichardSonButt
The values that are to be passed in the API is supposed to be in the alphabetical order. Like in my case above, if we arrange the keys in alphabetical order the keys will be: format, pbapisign (i.e. the public key) and pnr.So the string to be hashed will be 'json'.'
31 May 2015 by Sergey Alexandrovich Kryukov
Not only "flawed", but also "flawless" fragment is so wrong that it's really awkward to explain it. First of all, as Contains returns Boolean (and not nullable Boolean?), the is no point comparing it with true or false:bool something = //... no matter what//...// silliest thing:if...
31 May 2015 by Herboren
Took both SA and Gustafson advice. Thank you guys, The code below appears to workprivate void compareToolStripMenuItem_Click(object sender, EventArgs e) { string[] hashEntries = File.ReadAllLines(dlgFile.FileName); try { if...
23 Jul 2015 by kubibay
I'm trying to use elastic transcoder of Amazon. Here I need to sha-256 hash a string; http://docs.aws.amazon.com/general/latest/gr/sigv4-create-canonical-request.htmlI have tried any ways I have found on the net but I couldn't find the same result as page and some online hashing sites...
23 Jul 2015 by kubibay
Removing \r was the solutions = s.Replace("\r", "");
19 Nov 2015 by Member 12154285
I have been struggling with one of my homework questions for quite some time. I am attempting to implement a getLocation(hash1, x) method, which finds the location of the entry with key x. If such an entry does not exist, it returns the location where a new entry with key x should be stored. The...
27 Nov 2015 by sysabod
Hi all,I am reading "cryptography and network security principles and practice", in chapter 11.3, the book says:"Let us consider how many preimages are there for a given hash value, which isa measure of the number of potential collisions for a given hash value. Suppose the length of the...
9 Dec 2015 by Randy Ortan
public static class EncryptionUtilities { private const int SALT_SIZE = 8; private const int NUM_ITERATIONS = 1000; private static readonly RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider(); /// /// Creates a signature...
9 Dec 2015 by F-ES Sitecore
I'd advise you to first learn and understand what it is you're trying to do;https://crackstation.net/hashing-security.htm[^]The above link has c# examples, and there are other examples too if you google "c# hash passwords with salt".Second of all you're passing the result of a bool...
18 Nov 2016 by OriginalGriff
Pretty much, SHA is the "Best" algorithm for hashing passwords, mostly because MD5 is officially "broken" and is not recommended for new applications. That doesn't mean MD5 is actually bad, just that there are circumstances where you can "reverse" the hash to produce an "enterable" password that...
3 Dec 2016 by Member 12812147
Hi, I'm trying to hash english words from a txt file and store them in a table using chaining method . but i don't know what is wrong when i try to search and compare .this Error :"Exception thrown: read access violation.search was 0x1.If there is a handler for this exception, the...
2 Dec 2016 by Patrice T
Quote:"Exception thrown: read access violation.search was 0x1.If there is a handler for this exception, the program may be safely continued."There is no way that a simple handling of the exception can allow your program to continue safely.This message kindly tell you that you have a...
2 Dec 2016 by Richard MacCutchan
fscanf(dictionary, "%s",w);Node* new_word = new Node;//new_word->word = strcpy(new_word->word, w);new_word->word = w;So every Node.word in your dictionary points to a temporary block of memory that belongs to the Hash function and will disappear as soon as that function returns. You...
30 Aug 2017 by theskiguy
I have this code that I originally found in the VB Cookbook that checks 2 files for equality. The solution generates a checksum on each file and then compares the checksums. Everything has been working fine in my original app so I recently decided to use the same logic in another app. The...
6 Apr 2018 by Member 13603741
I've built a mini-kernel from scratch following some tutorials , and now i want to ensure that when i boot-up my system using a boot-loader i want from this one to hash and verify if it's my real system or an infected one !? using the hash and signature mechanism!! so please if someone could...
17 May 2018 by Chillin92
Currently, my project is using Hmac-SHA256 to do the authorization in APIM. We are struggle with how to generate, transmit and store the secret key between client side and ours. Is there any secure way to do this? What I have tried: For now, we are generating the secret key through openssl...
5 Jun 2018 by Jochen Arndt
Why do you open the file twice? As a result you will have two handles to the same file but only one will be closed because f holds internally the handle of the second call while the first handle is not accessible anmyore. Let the line where you declare (Dim) and assign f in place and remove...
24 Sep 2018 by Vaclav_
I am using nano editor to develop bash script on Linux. I am using bash -B option which makes a copy of the script raspi-config-DEBUG.sh raspi-config-DEBUG.sh~ Today I noticed I also have a ton of these files raspi-config-DEBUG.sh.save raspi-config-DEBUG.sh.save.1...
12 Oct 2018 by Member 13995616
struct person { char name[100]; int freq ; } ; I am creating an array of structure person and using this array as a hash table. int capacity; struct person table[capacity] ; I insert the string name by reading through a csv file which has a name on each of its line. When I take table...
12 Oct 2018 by k5054
Are you trying to dynamically adjust the size of your table variable? e.g. something like int get_int(void); // read an int from the user - not a standard function! int capacity; struct person table[capacity]; // more code here ... capacity = get_int(); for(int i = 0; i
21 Dec 2018 by Mehdi Gholam
Read this : Bloom filter - Wikipedia[^]
30 Oct 2019 by Kyudos
I have a set of nodes (N) arranged into one or more networks. Each network has one or more root nodes. Each node has a unique ID (UID) that is a 32-bit integer. If there were 100,000 nodes that would be a large problem - 1,000,000 would be almost infeasibly gigantic. I need to check if all nodes...
21 May 2019 by Member 14416409
Here I want to know what encryption or hashing method may have been used. Input is either "214364506" or "333844433". Output is "jrpen2pj". I am trying to find out what encryption or decryption may been used to convert "214364506" or "333844433" in to "jrpen2pj". Can anyone please help? ...
21 May 2019 by Richard MacCutchan
It is impossible to guess which type is used just from looking at the input and output values. If it was then the actual encryption would be compromised.
21 May 2019 by OriginalGriff
Even if it was possible to tell, you would need much better information: two inputs that generate the same output just indicate a very, very poor hashing algorithm - not encryption at all. The difference is that encryption can be reversed to recover the original input, which hashing can't. If...
18 Jul 2019 by F-ES Sitecore
If you are sending the encrypted credentials then that will never expire as long as the account is valid. If you want the logins to expire you'll need to generate a token that the client can use and that token will have an expiry date.
29 Oct 2019 by John M. Dlugosz
I recall this series of videos on YouTube: Let's make 16 games in C++/SFML! - YouTube[^] There is also this series from OneLoneCoder: Code-It-Yourself! - YouTube[^]