» 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?
Category : Programming Languages
> Hash[:a,2,:b,4]
=> {:a=>2, :b=>4}
> Hash[:a,1]
=> {:a=>1}
> Hash[[:a,1]]
=> {}
> Hash[[[:a,1]]]
=> {:a=>1}

View Replies


(Problem Solved) Hash(m1 xor m2) = Hash(m1) xor Hash (m2) Is this true in case of SHA1
Category : 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.


View Replies


How do `Hash#hash` and `Hash#initialize_copy` work?
Category : 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?


EDIT


I trie


View Replies


Saving a hash literal (telling Rails not to interpret hash as a nested attribute)?
Category : 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


{"utf8"=>"✓",
"authenti

View Replies


Implement a binary hash like http://www.fileformat.info/tool/hash.htm
Category : 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


06070405020300010e0f0c0d0a0b080976777475363636363636363636363636363636363636363636363636363636363636363636363636363636363636363653616d706c65202332


I took this value and inserted it into the binary h


View Replies


jQuery “window.location.hash” - getting hash too late?
Category : 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


View Replies


How to find and return a hash value within an array of hashes, given multiple other values in the hash
Category : 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


View Replies


How to make a hash key that would match/compare to the hash similar text/html?
Category : 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_

View Replies


Perl accessing the elements in a hash/hash reference data structure
Category : 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'
},<

View Replies


Access hash reference data using strings representing the hash structure
Category : 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


View Replies


Next
2012 / 2017 Copyrights BigHow , All Rights Reserved .