hashing

SHA1 hashing in SQLite: how?

Working with several DBs in parallel and need to initialize some records with hashed passwords. In MS SQL server there are handy functions that allow to hash on the fly: HashBytes('SHA1', CONVERT(nvarchar(32), N'admin')) Is there is a similar function with SQLite? If not, which is the easiest workaround (such as select from SQL serv...

password hashing

So Im working on a site(gaming community) that im aiming to release to the public soon. Currently Im working on the password part. I have only used md5 until now. I have read about password safety and heard that salting is currently the way to go. How does this sound to you? Every user has its own unique 12 length salt of random charac...

SHA1 JavaScript Implementation for large string

Hi All, I have the same problem as :Can SHA-1 algorithm be computed on a stream? With low memory footprint? I'm looking for a JavaScript implementation which computed block by block of a very large string. The idea is to slice the string into 512 bits block and do it block by block. Any hint? [updated] Thanks sunetos's help, I write ...

What hash function does Ruby use?

What is Ruby's hash function algorithm? ...

What is a good way to produce a random "site salt" to be used in creating password retrieval tokens?

I would like to create a site-wide hash to be used as salt in creating password retrieval tokens. I have been bouncing around stackoverflow trying to get a sense of the best way to do this. Here's the reset process: When a user requests a password reset email the code generates a retrieval token: $token = hash_hmac('sha256', $reset_h...

O(1) hash look ups?

I ran across an assertion that HashSet<T>.Contains() is an O(1) operation. This surprised me since every discussion of hashing I've encountered mentions the possibility of collisions, potentially leading to O(n) run time. Being curious, I looked into documentation for HashSet<T>.Contains and also HashTable.Contains. The documentation ...

Analysis of Permutation Finder algorithm(pseudo code)

A SO post about generating all the permutations got me thinking about a few alternative approaches. I was thinking about using space/run-time trade offs and was wondering if people could critique this approach and possible hiccups while trying to implement it in C#. The steps goes as follows: Given a data-structure of homogeneous elem...

Hashing SSNs and other limited-domain information

I'm currently working on an application where we receive private health information. One of the biggest concerns is with the SSN. Currently, we don't use the SSN for anything, but in the future we'd like to be able to use it to uniquely identify a patient across multiple facilities. The only way I can see to do that reliably is throug...

Hibernate: Strategy/pattern for object and entity identity mapping using composite keys?

What is a general collision-free Java best practice to generate hash codes for any-type (atomic types) multi-column primary keys? I thought about it for a few hours and came to the conclusion, that a string concatenated by all primary key columns would be the only reliable way to do so. Then calling Java's hashCode method on that concat...

C#/Java/Ruby - Hash Alogrthym for Passwords - Cross-Lang/Platform

What is a good password hashing algorithm to use from C#, if later on you may know that there are going to be Java and Ruby programs that may also need to 'login'/authenticate a user. Anything out of the box in .NET that translates well to other languages and is easy to use. ...

C# HMACSHA256 Problem - Matching Facebook Signed Request Implementation

Hi Everyone, I thought I would try and get the new Signed Request logic added to my facebook canvas application, to make this "easy" on myself I went to the facebook PHP sdk over at GitHub and took a look at the unit tests. http://github.com/facebook/php-sdk/blob/master/tests/tests.php My actual problem is that I cannot get the hash...

64 bit integer math and bitwise operation benchmarks

I'm trying to get a feel for the difference in performance between integer multiplication compared to bitwise operations... I have two potential hashing algorithms acting on 64 bit keys, one which uses a single multiply, single right shift, and single mask, the other which involves several shift and mask operations... but I want to try ...

Request for Comments: fast hashed base class for dictonary keys

In one of my aplications I have to use many dictonarys with custom objects as keys. To improve the performance of the lookups I implemetet an base class that overrites GetHashCode. It seams to work but somehow I still have a bad fealing about it so I decided to post my code and I would be gratefull for any tips or coments. (omg I forgot ...

Implementing GetHashCode based on a Connection String...

I am having difficulties following all of the rules for the GetHashCode method in MSDN for a class whose only property is a Connection String. I have tried just returning the hash of the string, but that returns a different value for the strings Provider=Microsoft.ACE.OLEDB.12.0; Data Source=path, Provider=Microsoft.ACE.OLEDB.12.0; Data...

Objective C: SHA1

Hi, How do i sha1 a string or set of numbers in Objective c? ...

Doing a hash by hand/mathematically

I want to learn how to do a hash by hand (like with paper and pencil). Is this feasible? Any pointers on where to learn about this would be appreciated. ...

best way to find webcontrols quickly

Request.Form[key] has a hashtable-like interface, but I doubt that's how it works. Is there a hashing mechanism for the current Page control set? How would one pass along a hashed set of all controls between postbacks? ...

(almost) Non-colliding simple hashing function for use in a switch

Hi, I am writing an advanced calculator in C. As you can guess, it currently has many functions, and I use a switch to do the proper operation for every function name. It goes something like this: switch(hash_of(function_name_currently_being_parsed)) { case HASH_COS: // do something break; case HASH_SIN: // do something...

Why are Crypto++ and Ruby generating slightly different SHA-1 hashes?

I'm using two different libraries to generate a SHA-1 hash for use in file validation - an older version of the Crypto++ library and the Digest::SHA1 class implemented by Ruby. While I've seen other instances of mismatched hashes caused by encoding differences, the two libraries are outputting hashes that are almost identical. For insta...

Hash function to produce a code of 30 chars?

I need to hash a message into a string of 30 chars. What's the best and most secure hash function for this usage? ...