hash

Doing a hash by hand/mathematically

I want to learn how to do a hash by hand (like with paper and pencil). Is this feasible? Any pointers on where to learn about this would be appreciated. ...

Store and retrieve friends contact list using mysql

Hi I want to create a database that can store the friends contact list as like social networking what is the best way to design the database structure and easy to retrieve the contacts of friends using mysql. i need solution for this, HELP ME regards ~Deepu~ ...

SHA1 collision demo / example

This question is similar to this, but that one only references MD5 collision demos. Are there any actual SHA1 collision pairs of arbitrary messages known so far ? I'd like to use these to test how various software products (my own one and some third party) deal with it. Doing some Google searches only turned up the oh-so prominent MD5...

Size of hash instance variable

I have a Perl class that contains a hash instance variable for storing other objects. I would like to have a method to print the number of elements in the hash but I am getting the following error message on the line return keys($self->{'_things'}); Type of arg 1 to keys must be hash (not hash element) package MyClass; use strict; sub...

How to decode with MessageDigest , Base64

I am currently encoding a password. I have to decode the password. Here is the code to encode. I am trying to get the original password compare it. I have researched about MessageDigest that says it is a one-way method. Not sure how to get the original message. We have a decode method but it isn't giving me the original password - ...

Object as hash key

Is it possible to use an object as a hash key? For example, the following code allows me to use an instance of MyClass as a key but when I iterate over the keys and attempt to invoke the get_value method, I get the error: Can't locate object method "get_value" via package "MyClass=HASH(0x12a4040)" (perhaps you forgot to load "MyClass=H...

Return a single Element from an Associative Array from a Function

Lets assume we have two PHP-Arrays: $some_array = array('a','b','c','d','e','f'); $another_array = array(101,102,103,104,105,106); In PHP, there are already some Array-Functions that allow the construction of an Associative Array (AKA hash), e,g,; $hash = array_combine( $some_array, $another_array );...

How to parse a yaml file into ruby hashs and/or arrays?

I need to load a yaml file into Hash, What should I do? ...

Hashing of Key-Value pair on Hashpass.com

Just found this website: hashpass.com and here is the JS implementation which they use to encrypt the key-value pair: http://hashapass.com/sha1.js So, can there be a "simple" and obvious alternative to this? Thanks ...

php make unique hash of rss description

Hi all, im using php to create a sorta rss aggregator that stores data from multiple site rss feeds into a mysql database. since articles could be duplicated on many websites, i want to avoid this. ive been told you could use hashing to make unique hashes based on content of rss[description + title]. Now which hashing algorithm is fas...

iterating hash collection

{"Journal"=>[[4, -785.0], [13, -21.9165000915527], [14, -213.008995056152], [15, -50.074499130249]]} How can you to iterate this hash in Ruby, and how would you to separate out keys & values? ...

access to hash through an variable in ruby on rails

Hello I have following problem. I have a hash filled with the html parameters (params): Parameters: "info"=>{"parameter2"=>{"r1"=>"aa", "r2"=>"bb", "r3"=>"cc", "r4"=>"dd", "r5"=>"ee"} You can access this values like this: <%= params[:info][:parameter2][:r1] %> --> it works fine But I have a loop, and want to access these values ...

Identical hashes for a guid in both C# and javascript

I have a problem where I need to be able to generate identical uniformly distributed numeric hashs for a GUID in both javascript and C#. I guess that would prevent me from using Guid.GetHashCode() in C#, since I can't reproduce the behavior in JS without reverse engineering the C#. Is there a fast way to produce hashes from guids/string...

gcc with boost for tr1, hash functor specialization

I am using boost for tr1 instead of gcc 4.5's native tr1 libraries (by prioritizing boost tr1 headers over gcc headers). There is a compile problem specializing std::tr1::hash. #include <functional> #include <memory> template <class A> struct std::tr1::hash< std::tr1::shared_ptr<A> > : public unary_function< std::tr1::shared_ptr<A>...

Why Ruby's array of 1000 hashes' key and value pairs are always in a particular order?

Say if there is an array of 1000 hashes, with pairs like {:id => 1, :name => 'something', :created_at => '2010-08-18'} when I use a loop to print out those 1000 records, supposedly, the hash's key / value pair order is not guaranteed, but the print out of the table, it always appear in the same order. Why is it and can it be counted on...

Trying to port C# function to PHP5

I'm trying to convert this function into PHP but somehow it does not give same results. public static string EncodePassword(string pass, string salt) { byte[] bytes = Encoding.Unicode.GetBytes(pass); byte[] src = Convert.FromBase64String(salt); byte[] dst = new byte[src.Length + bytes.Length]; byte[] inArray = null; ...

How does Git track history during a refactoring ?

I understand well how Git can support file moves : as it uses file hash, a "added" file is easily detected as beeing same as the "removed" one. My question is about refactoring : considering Java, the package declaration changes so the file content will NOT be the same. In such case, how does Git determine that the "added" file shares h...

jQuery hashing and loading file, string formating?

Hey. I'm loading content dynamically like this: $("#id a").click(function(e){ e.preventDefault(); var hash = this.parentNode.hash; $("#show").load('files/'+ hash +'.html'); $("#show").fadeIn(300); }); But the hash is #first, #second, #third so I have to name files #first.html, #second.html etc. Ho...

How to generate a hash of the result set in Postgress?

Hi. I have two databases for logging stuff, which I want to check for synchronization. The solution approved is to send periodically (lets say hourly) a select to both, generate a hash of the result set and compare them. If they match then great, otherwise generate some alarms. Currently I'm doing it by (bash script): log_table="SEL...

Hash function to produce a code of 30 chars?

I need to hash a message into a string of 30 chars. What's the best and most secure hash function for this usage? ...