hash

How to pass parameters with hash in PHP

Hello, Recently when i saw google results page, the query and other parameters where passed with # (hash) instead of the usual "?" Also, in facebook i saw the same thing. This was quite interesting and after a simple search with google, i found the results related to perl and Ruby but no result with PHP. Is it possible to pass parame...

Searching for commits which reference a given object

I've got a file that's been installed on my system that is known to be part of a git repo. I'd like to find out which commit(s) (re-)introduced that version of that file, ie which commit is responsible for putting the file in its current state. I know that the file is in the repo because git show $(git hash-object $the_file) works. At...

Working with nested information in controller/views

This is a beginner's question but for some reason I cannot find the answer elsewhere. Customer has_many orders Order has_many order_items I am in customer/show.html.erb and I want my customer to manipulate order_items. Many orders have many order_items and I want to search ALL of those order_items to find those such that read == fa...

Is prepending salt to the password instead of inserting it in the middle decreases security?

Hi, I've read somewhere that adding a salt at the beginning of the password before hashing it is a bad idea. Instead, it is much more secure to insert it somewhere in the middle if the password. I don't remember where I've found this, and cannot neither find any other articles saying the same thing, nor understand why this may increase...

[php] phpass autologin?

Hello! How are you supposed to create an autologin feature on your webpage using phpass as encryption of the passwords? I mean, the way it checks the password is by giving the CheckPassword method the password in clear-text and a hashed string of that password (a previously stored hash that is). Then it returns true/false wheter its cor...

c string compare vs hash compare

I need to compare a string to multiple other constant strings in c. I am curious which is faster, to hash the string I am going to compare and compare it to all the other constant string hashes or just compare the strings as strings. thank you in advance thank you for the answers I am going to be doing many comparisons. can anyone give ...

How to calculate the hash value of a torrent using Java

How can I calculate the hash value of a torrent file using Java? Can I calculate it using bencode? ...

Hashing no longer works in .Net 4.0 despite MSDN workarounds

I have an existing app in production that uses SqlMembershipProvider and has a specified machine key: <machineKey validationKey="..." decryptionKey="..." validation="SHA1" decryption="AES"/> It runs under .Net 2.0 AppPool currently. I'm writing a new application that has to use the existing database, which I have a backu...

Ruby model with an array as an attribute

Hello, I am currently trying t implement a model to simplify graphical chart creation. However, one of the attributes must be an array of attributes. For example: "Chart_Series" has a "name" which would be a string and a data field which would be separated by dates which is an array of arrays [[Date1, Value1],[Date2,Value2],[Date3,Value...

Accesing hash keys and attributes from the view

Hello, in an attempt to create a model with an array as an atribute, i ended up creating an array of hashes like so: data1 = {} data1[:name] = "Virtual Memory" data1[:data] = @jobs.total_virtual_memory data2 = {} data2[:name] = "Memory" data2[:data] = @jobs.total_memory @data = [] @data << data1 @data...

How do I hash first N bytes of a file?

Using .net, I would like to be able to hash the first N bytes of potentially large files, but I can't seem to find a way of doing it. The ComputeHash function (I'm using SHA1) takes a byte array or a stream, but a stream seems like the best way of doing it, since I would prefer not to load a potentially large file into memory. To be cl...

Hashing of pointer values

Sometimes you need to take a hash function of a pointer; not the object the pointer points to, but the pointer itself. Lots of the time, folks just punt and use the pointer value as an integer, chop off some high bits to make it fit, maybe shift out known-zero bits at the bottom. Thing is, pointer values aren't necessarily well-distrib...

What algorythm could generate this hash?

Hello! I need to know how to generate this kind of hash. What dows it look like? What could be algorythm name that generated it? 3MJVKXEPzins+VZjNUq1Xw== ...

Ruby: Removing all empty elements from a hash / YAML?

How would I go about removing all empty elements (empty list items) from a nested Hash or YAML file? Thanks for any advice. ...

Java HashMap detect collision

Is there a way to detect collision in Java Hash-map ? Can any one point out some situation's where lot of collision's can take place. Of-course if you override the hashcode for an object and simply return a constant value collision is sure to occur.I'm not talking about that.I want to know in what all situations other that the previously...

Idiomatic way to pass a method name for evaluation in Clojure?

I'm passing the name of a function for use in another method. (defn mapper [m function] (cond (= '() m) '() true (cons (function (first m)) (mapper (rest m) function)))) (println (map_ '((blue red)(green red)(white red)) #'first)) Is there a more idiomatic way to do this in clojure? ...

How does Gmail handle back/forward in rich JavaScript?

Gmail seems to have some clever way of handling the back/forward buttons in a rich JS application. In my organisation we trialled the jQuery history plugin. The plugin basically runs a function every 100ms which parses the URL and tests if it has changed. The history is tracked by HTTP anchors, and if the anchor has changed then the plu...

In VB.NET, what data structure to use so that, given two characters, return an integer for optimum performance?

I am finishing up a program that does a large number of calculations and am trying to optimize the innermost loop. The calculation I am currently looking at iterates over a large number of pairs of words and makes a table of the counts of corresponding pairs of characters. For example, one pair of words might be: voice louse and the...

Can I use Object#hashCode to store the hash of a password?

To save a file i defined the following method public int encrypt(String fileName, String password) { return (fileName.concat(password)).hashCode(); } This returns a hashvalue that is stored in a file. Whenever the user wants to access the file, he enters the password, and if the same hash is generated, he can access the file. I su...

Comparing string distance based on precomputed hashes

I have a large list (over 200,000) of strings that I'd like to compare to a given string. The given string is inserted by a user, so it may be slightly incorrect. What I was hoping to do was create some kind of precomputed hash on each string on adding it to the list. This hash would contain information such as string length, addition...