hash

How can I use dispatch tables in Perl?

Possible Duplicate: How do I implement dispatch tables in Perl? I have a hash table that contains commands such as int(rand()) etc. How do I execute those commands? ...

SimHash implementation in Java?

Has anyone come across a simhash function implemented in Java? I've already searched for it, but couldn't find anything. ...

How to implement session based "add to cart" function in Rails

Hi I have a problem implementing add to cart functionality in my rails e-commerce app. Here I am not talking about check out function. Just "add to cart". Items can be added to cart without requiring users to log in to their accounts. Once the user finishes adding to cart, then before check out user will log in. My problem here is what i...

Create your own hash in PHP ?

Well, I need to save images with unique filenames and store the file names in the database. I used to do MD5 hash and save the image with the filename of value obtained by hash. However I would like to cut down the unnecessary space usage from 32 characters to 10-12 characters. I dont want to substr() the obtained md5 hash to 12 charac...

SCrypt implementation for Java?

The original SCrypt implementation is in C. Are there any known Java ports? ...

Restricting access to server to iPhone app

I'm building a client/server iPhone game, where I would like to keep third-party clients from accessing the server. This is for two reasons: first, my revenue model is to sell the client and give away the service, and second I want to avoid the proliferation of clients that facilitate cheating. I'm writing the first version of the serv...

Hash Object problem in C++

Hello, In some C++ program I have two classes - Abc and Xyz. The Abc class contains an integer member Foo, like in the following listing: class Abc { public: int Foo; Abc(int f) { Foo = f; } }; class Xyz{}; I'm using a map<Abc, Xyz> but the performance is extremly poor. That's why I'd like to use a hash_map<Abc, Xyz> (Dev-Cp...

Any value in salting an already "strong" password?

Is there any benefit in salting passwords for a strong, unique (not used for other applications by the user) password? Salting (as I am aware) protects against rainbow tables generated with a dictionary or common passwords. It also protects against an attacker noticing a user with the same hash in another application. Seeing as a stron...

Change hash without reload in jquery

Hello, I have the following code:- $('ul.questions li a').click(function(event) { $('.tab').hide(); $($(this).attr('href')).fadeIn('slow'); event.preventDefault(); window.location.hash = $(this).attr('href'); }); This simply fades a div in based on when you click but i want the page url hash tag to change when you click so people...

Flex: Stop TabNavigator from adding #HASH to URL

Ok I have a TabNavigator component that keeps added a hash (#) to the URL. I need to prevent this. I have it set to historyManagementEnabled="false" but it is still adding the # to the URL when it initializes. The reason why adding this hash is such a problem is because, I am using .htaccess to give my URL a pretty URL like domain.com/d...

How do I undefined the value for a hash key in Perl?

#!/usr/bin/perl use strict; use warnings; my %hash; undef($hash{"a"}); undef($hash{"b"}); print scalar values %hash; # i need here 0 print scalar keys %hash; # and here 2 thank you, guys! ...

Trouble using hash function.

Hi all, I am implementing google's dense hash map in my C++ code. I want to use MurmurHash2 (http://murmurhash.googlepages.com/) as a hash function. But here's the problem. I have tried a lot but cant seem to get the hash function to work. The example shows the use of a default hash function (hash< const char * >). dense_hash_map < ...

I don't want url #hash to be in the url after submitting the form

update: In this case action="url.php" works as I desired When I submit a form (I use get method), the url #hash part also got appended to the end of url after submit of the form. I tried to change the action of the page to get rid of this url #hash from the string. I removed the action part from the form, provided action as action="url....

hashing a dictionary in C++

hi I want to use a hashmap for words in the dictionary and the indices of the words in the dicionary. What would be the fastest hash algorithm for this? Thanks! ...

How to know calculate the execution time of an algorithm in c++?

Hi, I want to test which data structure is the best by looking at the run-time performance of my algorithm, how do I do it? For example I already have a hashmap<string, int> hmp; assuming I have "apple" in my hashmap I want to know how long the following statement takes to execute: hmp["apple"]. How can I time it? Thanks! ...

How to use a hash_map with case insensitive unicode string for key?

I'm very new to STL, and pretty new to C++ in general. I'm trying to get the equivalent of a .NET Dictionary<string, value>(StringComparer.OrdinalIgnoreCase) but in C++. This is roughly what I'm trying: stdext::hash_map<LPCWSTR, SomeStruct> someMap; someMap.insert(stdext::pair<LPCWSTR, SomeStruct>(L"a string", struct)); someMap.find(L...

MD5 File Hashing - match Delphi output with PHP md5_file function

I'm currently using this code for md5 hashing in Delphi 7: function MD5(const fileName : string) : string; var idmd5 : TIdHashMessageDigest5; fs : TFileStream; begin idmd5 := TIdHashMessageDigest5.Create; fs := TFileStream.Create(fileName, fmOpenRead OR fmShareDenyWrite) ; try result := idmd5.AsHex(idmd5.HashValue(fs)) ; ...

What is a fast efficient way to find an item?

Hi so I need some FAST way to search for a word in a dictionary. The dictionary has like 500k words in it. I am thinking about a using a hashmap where each bin has at most 1 word. Ideas on how to do this or is there something better? ...

Order perserving minimal perfect hash functions

Hi, I want to implement an OPMPH function for the words in a dictionary in C++. How do I do it? Thanks! ...

How to see hash items in C++?

Hi so I have the following code and I want to be able to insert words into it and be able to see the stuff I put into the hash by printing it out. Here's what I have: #include <iostream> #include <fstream> #include <string> #include <hash_map> #include <set> #include <windows.h> using namespace std; struct nlist{ struct nlist *nex...