hashing

What is the purpose of the "salt" when hashing?

Ok, I’m trying to understand the reason to use salt. When a user registers I generate a unique salt for him/her that I store in DB. Then I hash it and the password with SHA1. And when he/she is logging in I re-hash it with sha1($salt.$password). But if someone hacks my database he can see the hashed password AND the salt. Is that hard...

What's the point in providing an MD5 or SHA1 hash along with a downloadable executable?

I thought they were there for security; to check that the file hasn't been tampered with. But surely if someone is capable of modifying the file then they are also capable of modifying the page with the hash! What security does this actually offer? ...

Are there common methods for hashing an input file to a fixed set of values?

Let's say I'm trying to generate a monster for use in a roleplaying game from an arbitrary piece of input data. Think Barcode Battler or a more-recent iPod game whose name escapes me. It seems to me like the most straightforward way to generate a monster would be to use a hash function on the input data (say, an MP3 file) and use that h...

How to get a sha256 hash of a file using ANSI C

Simply what the topic states, what's a memory efficient way to compute a sha256 hash of a file that's variable in size? I'm also willing to compromise using more memory for faster computation. ...

Iterative hashing

I'm just wondering, is there a reason why some libraries (be it any language) use iterative hashing such that the hashed data is encoded in hex and rehashed again instead of rehashing the actual binary output? ...

Simple hash function (1 byte output from string input)

Hi folks, I'm looking for a simple hash algroithm that will give me one byte of output for a string input (the inputs will be RFC822 email addresses, if that helps). I'd like it to be simple, fast, and to magnify input differences (so two similar addresses have differnt outputs). (Yes, I am asking for a lot in one byte of output.) Id...

Use a Java hash map even when there is no "mapping"?

I want to store some objects and then be able to retrieve them later as efficiently as possible. I will also remove some of them under certain conditions. It seems a hash map would be the right choice. But, from what I've seen, hash maps always associate a value with another? For example, "john" and "555-5555", his phone number. Now, m...

Hashing a Tree Structure

I've just come across a scenario in my project where it I need to compare different tree objects for equality with already known instances, and have considered that some sort of hashing algorithm that operates on an arbitrary tree would be very useful. Take for example the following tree: O / \ / \ O O ...

A hashing function which recursively builds?

Is there a (Well known) hash function for string s which can be computed from hashes of subsets of s. e.g. hash(0 to x) is hash(0 to x/2) + hash(x/2 to x) // plus or any other mathematical operation ...

In PHP, what is the difference between hash and mhash?

I'm wondering what is the difference between the hash extension and the mhash extension? When should I choose one over another and why? ...

Creating a hash of a string thats sortable

Is there anyway to create hashs of strings where the hashes can be sorted and have the same results as if the strings themselves were sorted? ...

How to salt and hash a password value using c#?

Hai guys, I came to know that storing hash value of a password is a safe one from Preferred Method of Storing Passwords In Database... How to salt and hash a password value using c#? How to compare both the values stored in DB and the one given by the user? ...

A simple, repeatable hash from an UInt32 to a UInt16

I have a little problem where need to do a hash of a number of about 10 digits into a number of 6 digits. The hash needs to be deterministic. It's more important that the hash is not resource intensive. For example, say that I have some number, x, like 123456789 I want to write an hash function that gives me a number, y, back like 987...

How to handle new files to process in cron job

How can I check files that I already processed in a script so I don't process those again? and/or What is wrong with the way I am doing this now? Hello, I am running tshark with the ring buffer option to dump to files after 5MB or 1 hour. I wrote a python script to read these files in XML and dump into a database, this works fine. My ...

randomized binary search trees

Randomized binary search trees like treap give a good performance (in the order of O(log n)) with high probability while avoiding complicated (and costly) rebalancing operations that are needed for deterministic balanced trees like AVL, red-blackm, AA, etc. We know that if we add random keys to a simple BST, we can expect it is reasonab...

Using object id as a hash for objects in Python

Is it wise to use the object id as a hash key (via. the __hash__) to be able to hash an otherwise mutable object for a single instance of a program? Using the object attributes would be nicer but they're all mutable and can change. This occurred to me while looking at http://stackoverflow.com/questions/2038010/sets-of-instances/2038019...

Index Hashing vs Normal Hashing

What is index hashing ? What are its advantages over regular hashing techniques ? ...

Hash Table Key generation

I am trying analyze a code to parse a string which has a maximum string length of 4000 characters . The coder is using the following following formula to generate the key (fromid^(from_id<<18)^(toid<<2) ^(toid<<16)^(repetition<<4)^(repetition<<14)^ (tbranch_id<<6)^(tbranch_id<<12)^ (fbranch_id<<8))^(fbranch_id<<10) I cant understand ...

Compile time string hashing

I have read in few different places that using c++0x's new string literals it might be possible to compute a string's hash at compile time. However, no one seems to be ready to come out and say that it will be possible or how it would be done. Is this possible? What would the operator look like? I'm particularly interested use cas...

Reasons why SHA512 is superior to MD5

I was wondering if I could reasons or links to resources explaining why SHA512 is a superior hashing algorithm to MD5. ...