how does the hashCode() method of java works ?
Hello I am curious how java generates hash values by using hashCode() method of the Object API ? ...
Hello I am curious how java generates hash values by using hashCode() method of the Object API ? ...
Hello, I am writing a simple Python program. My program seems to suffer from linear access to dictionaries, its run-time grows exponentially even though the algorithm is quadratic. I use a dictionary to memoize values. That seems to be a bottleneck. The values I'm hashing are tuples of points. Each point is: (x,y), 0 <= x,y <= 50 ...
I'm following the example of code available in: http://www.openssl.org/docs/crypto/sha.html# After the following: EVP_DigestFinal_ex(&mdctx, md_value, &md_len); the final digest is stored in md_value. I'd like to copy that digest to another character array of equal size. This is a two part problem though. I'm not understanding what e...
Hi all! There's a website that generates a password by joining a master password with the website's name (e.g. master password=abc and site=google) then hashing that with SHA1 and then coding the resulting hash with Base64. I've been trying to implement that in Bash, but I can't. I mean I can but my results are extremely different from t...
My website doesn't contain too sensitive data. I'm thinking about storing passwords as is because if a user wanted to receive their password by email (if they'd lost it) then I'd be able to send it to them rather than doing anything cumbersome and grueling to users like sending them a new password I created (it's also ineffective). Shou...
I have several Sets that store the objects of the same class, but I want to specify a different identity function for each of them (i.e. say, in one set A==B if A.x==B.x, while in another A==B if A.y==B.y). Currently I use TreeSets with different Comparators defined for each. I am wondering how the same thing can be done if I want to sw...
Hi, I was comparing a simple hash function that I wrote which just multiplies it by a prime mod another prime number (the table size) and it turns out that stl is slower by 100 times. This is the test method that I wrote: stdext:: hash_map<string, int> hashDict; for (int l = 0; l < size; ++l){ hashDict[arr[l]] = l; } long int before...
I want to know how stl hash_map is implemented. How do I find out what the table size is and the memory space the map consumes? This is in C++. ...
A project I'm working on requires detection of duplicate files. Under normal circumstances I would simply compare the file bytes in blocks or hash value of the entire file contents. However, the system does not have access to the entire file - only the first 50KB or so. It also knows the total file size of the original file. I was think...
Hi, I need to pass (via string content of a HTTP request/response body) name value pairs of data (like a hash) back from a Ruby on Rails server to a C# client. Anyone happen to know offhand what would be the best format to do this in? Probably XML I would guess? tks PS. So overall the requirement is find a C# method that convert f...
Update: This question has been solved, so the buggy Firefox behavior will no longer appear when loading my example webpage My webpage has very long passages of text, so I want to make each paragraph its own permalink. To do this, I use jQuery to add an anchor and link to each paragraph after the page loads. This worked perfectly in Chro...
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 ...
How can I remove the hash sign (#) from the page's URL ? I am using the SWFAddress plugin (jQuery) for deep linking purposes. I need to replace this localhost/site/#blog by localhost/site/blog (Yes, #blog is just an anchor). Somehow url rewriting in .htaccess doesn't work RewriteRule /blog #blog [L] Any suggestions ? ...
This is the code snippet I am working with: my %photo_details = ( 'black_cat' => ( ('size' => '1600x1200', 'position' => -25), ('size' => '1280x1024', 'position' => 25), ('size' => '800x600', 'position' => 0), ), 'race_car' => ( ('size' => '1600x1200', 'position' => 10), ('size' => '800x600', 'position' => 5), ),...
Hello, During an assignment, I was asked to show that a hash table of size m (m>3, m is prime) that is less than half full, and that uses quadratic checking (hash(k, i) = (h(k) + i^2) mod m) we will always find a free spot. I've checked and arrived to the conclusion that the spots that will be found (when h(k)=0) are 0 mod m, 1 mod m, ...
How strong do salts need to be? At the moment I use this function to generate a "unique" salt upon user registration: $salt = substr(str_shuffle('0123456789abcdefghijklmnopqrstuvwxyz'), 0, 12); I then hash it with sha1 along with the password. What do you think? PS. I'm not planning on getting MySpace big. ...
I was given as homework the "Introduction to Algorithms" exercise 11.1-3 which goes as follows: Suggest how to implement a direct-access table in which the keys of stored elements do not need to be distinct and the elements can have satellite data. All three dictionary operations (Insert, Delete and Search) should run in O(1) time. D...
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 ...
I'm wondering what is the difference between the hash extension and the mhash extension? When should I choose one over another and why? ...
i'm weak in regular expressions, i need to redirect any FileName.htm or FileName.html page request to ./#FileName, only if the request is incoming from an outside link. These files will all reside in the root directory. this is what i have so far. it gives me errors : ( RewriteCond %{REQUEST_FILENAME} !index.html$|!index.htm$ [NC] Rew...