» Home » hash » Page 1
In Ruby, why is Hash[:a, 1] and Hash[[[:a, 1]]] giving the same result {:a => 1}, while Hash[[:a,1]] gives an empty hash?
by Dannar26 in Programming Languages
> Hash[:a,2,:b,4]
=> {:a=>2, :b=>4}
> Hash[:a,1]
=> {:a=>1}
> Hash[[:a,1]]
=> {}
> Hash[[[:a,1]]]
=> {:a=>1}

(Problem Solved) Hash(m1 xor m2) = Hash(m1) xor Hash (m2) Is this true in case of SHA1
by swinaz in Web Design

Can anyone shed some knowledge on this?

My answer is no, it is not true, because SHA1 has a strong collision resistant property.

How do `Hash#hash` and `Hash#initialize_copy` work?
by Gunbuster in Programming Languages

I found one instance method Hash#initialize_copy. But nothing is documented. Can anyone help me in this regard with some code?

How does Hash#hash compute hash code? What is the logic behind it? What are the scenarios where hash codes are used? Does each key of a hash, say h, always have different hash code?


I trie

Saving a hash literal (telling Rails not to interpret hash as a nested attribute)?
by dunlop in Programming Languages

I think Rails is interpreting my hash literal as a nested attribute. I would actually just like to convert the hash to a string. It's not a nested attribute related to some model, nor should it be related to a model. Here, nesting the values is merely a convenient way to pass data through a form without too much busywork.

:params was


Access hash reference data using strings representing the hash structure
by Tristan in Programming Languages

Let's assume that I have a complex hash reference $hash_ref, and I would like to access data in it by doing something like this:

my $string1 = "{books}";
my $string2 = "{31335}->{book_name}";
print Dumper($hash_ref->$string1->$string2);

Of course, this doesn't work, but I hope it explains what I'd like to do.

Obviously, there ar

Implement a binary hash like http://www.fileformat.info/tool/hash.htm
by AnToni00 in Programming Languages

I have been struggling for 4 days trying to implement a hash algorithm in c# which works like the FIPS 198 standards document. I have reached a point where I have a value of


I took this value and inserted it into the binary h

How to make a hash key that would match/compare to the hash similar text/html?
by Dopey in Programming Languages

I would like to make a sort of hash key out of a text (in my case html) that would match/compare to the hash of other similar text

ex of matching texts:

"2012/10/01 This is my webpage #1"+ 100k_of_same_text + random_words_1 + ..
"2012/10/02 This is my webpage #2"+ 100k_of_same_text + random_words_2 + ..
"2012/10/02 This is my webpage #2"+ 100k_of_same_

jQuery “window.location.hash” - getting hash too late?
by nascentmind in Web Design

I'm working on some script but it have a serious problem with hashes.

I have a list of link-images like:

<a href="#1"><img src="1.jpg" /></a>
<a href="#1"><img src="2.jpg" /></a>
<a href="#1"><img src="3.jpg" /></a>

All I want to do is to load file files/#1.html after clicking the fir

How to find and return a hash value within an array of hashes, given multiple other values in the hash
by cakephp in Programming Languages

I have this array of hashes:

results = [
{"day"=>"2012-08-15", "name"=>"John", "calls"=>"5"},
{"day"=>"2012-08-15", "name"=>"Bill", "calls"=>"8"},
{"day"=>"2012-08-16", "name"=>"Bill", "calls"=>"11"},

How can I search the results to find how many calls Bill made on the 15th?

After reading t

Perl accessing the elements in a hash/hash reference data structure
by Icecold in Programming Languages

I have a question I'm hoping you could help with as I am new to hashes and hash reference stuff?

I have the following data structure:

$VAR1 = {
'http://www.superuser.com/' => {
'difference' => {
'http://www.superuser.com/questions' => '10735',
'http://www.superuser.com/faq' => '13095'

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .