hash

Why this code generates different numbers?

Hello, I have this function that creates a unique number for hard-disk and CPU combination. GetVolumeInformation(drv, szNameBuffer, 256, &dwHddUnique, NULL, NULL, NULL, NULL); SYSTEM_INFO si; GetSystemInfo(&si); dwProcessorUnique = si.dwProcessorType + si.wProcessorArchitecture + si.wProcessorRevision; dwUniqueKey...

WebApp Password Management - Hashing, Salting, etc...

Hi there. Im searching for the most secure (but yet doable) way of password management in a web app. Right now, I save the password as hash. The DB account of the app is restricted to excecution of stored procedures and I authenticate users by giving the username and the hashed password to a stored procedure that returns 1(true) or 0(...

assign characters to key combinations in XP or Visual Studio .Net

I'm running Mac OSX on a MacBookPro (UK keyboard). I run windows XP under parallels in a VM. I run Visual Studio .Net 2003 and 2008 in XP in the VM when i need to. I have English United Kingdom and English United states keyboards setup in XP. (they switch sometimes for no apparent reason) There is no hash "#" key on my mac's keyboard. H...

Lists Hash function

I'm trying to make a hash function so I can tell if too lists with same sizes contain the same elements. For exemple this is what I want: f((1 2 3))=f((1 3 2))=f((2 1 3))=f((2 3 1))=f((3 1 2))=f((3 2 1)). Any ideea how can I approch this problem ? I've tried doing the sum of squares of all elements but it turned out that there are ...

Using hashing to group similar records

I work for a fulfillment company and we have to pack and ship many orders from our warehouse to customers. To improve efficiency we would like to group identical orders and pack these in the most optimum way. By identical I mean having the same number of order lines containing the same SKUs and same order quantities. To achieve this I w...

What is the easiest way to get a key with the highest value from a hash in Perl?

What is the easiest way to get a key with the highest value from a hash in Perl? ...

When is it safe to use a broken hash function?

It is trivial to use a secure hash function like SHA256 and continuing to use md5 for security is reckless behavior. However, there are some complexities to hash function vulnerabilities that I would like to better understand. Collisions have been generated for md4 and md5. According to NIST md5() is not a secure hash function. It ...

Hash#key for 1.8.6

Greetings, I am trying to make my 1.9.1 source 1.8.6 compatible. I recognized that there's no Hash#key method. Any idea or method how to solve that? Thanks! Tobias ...

PHP CRC32 length output

Hi! Is there anything that can make the returned length of the PHP CRC32 function to vary? Thanks! ...

Summarize object area with a Hash in Ruby

require 'sketchup' entities = Sketchup.active_model.entities summa = Hash.new for face in entities next unless face.kind_of? Sketchup::Face if (face.material) summa[face.material.display_name] += face.area end end Im trying to get the structure in the array as such: summa { "Bric...

Distributions and hashes

Has anyone ever had an incidence of downloading software from a genuine site, where an MD5 or SHA series hash for the download is also supplied and then discovered that the hash calculated from the downloaded artifact doesn't match the published hash? I understand the theory but am curious how prevalent the problem is. Many software pub...

MD5 hash differences between Python and other file hashers

I have been doing a bit of programming in Python (still a n00b at it) and came across something odd. I made a small program to find the MD5 hash of a filename passed to it on the command line. I used a function I found here on SO. When I ran it against a file, I got a hash "58a...113". But when I ran Microsoft's FCIV or the md5sum.py...

Perl, convert hash to array

If I have a hash in Perl that contains complete and sequential integer mappings (ie, all keys from from 0 to n are mapped to something, no keys outside of this), is there a means of converting this to an Array? I know I could iterate over the key/value pairs and place them into a new array, but something tells me there should be a built...

How do I create a hash of hashes in Perl?

Based on my current understanding of hashes in Perl, I would expect this code to print "hello world." It instead prints nothing. %a=(); %b=(); $b{str} = "hello"; $a{1}=%b; $b=(); $b{str} = "world"; $a{2}=%b; print "$a{1}{str} $a{2}{str}"; I assume that a hash is just like an array, so why can't I make a hash contain another? ...

Ruby Hash.merge with specified keys only

I'm pretty sure I saw on a Rails related site something along the lines of: def my_function(*opts) opts.require_keys(:first, :second, :third) end And if one of the keys in require_keys weren't specified, or if there were keys that weren't specified, an exception was raised. I've been looking through ActiveSupport and I guess I might...

How are cryptographic hash functions designed?

After reading about why one-way hash functions are one-way, I would like to know how to design a hash function. Yes, I know that it's a bad idea to not use a proven and tested hash function, but I would still like to know how what matters in the design, and what the design process is like. I'm familiar with Feistel-network ciphers but ...

Trying to reference a hash using a string value in Ruby

How would I refer to a hash using the value of a string - i.e. #!/usr/bin/env ruby foo = Hash.new bar = "foo" "#{bar}"["key"] = "value" results in foo:5:in `[]=': string not matched (IndexError) from foo:5 How do I use the value of bar (foo) to reference the hash named foo? Thanks! ...

How do I interact with a Perl object that has a hash attribute?

I have a class with several variables, one of which is a hash (_runs): sub new { my ($class, $name) = @_; my $self = { _name => $name, ... _runs => (), _times => [], ... }; bless ($self, $class); return $self; } Now, all I'm trying to do is create an accessor/mutator, as well...

Convert base64'd SHA1 hashes to Hex hashes

I have a list of passwords in mySQL that are generated using $hash = '{SHA}' . base64_encode(sha1('some string here', true)); I need to convert these into what would be the equivalent of $hash = sha1('some string here'); As these are password that our mail system uses, and we want to convert to another mail system (but requires th...

c# How to find if two objects are equal

Hi, I'm needing to know the best way to compare two objects and to find out if there equal. I'm overriding both GethashCode and Equals. So a basic class looks like: public class Test { public int Value { get; set; } public string String1 { get; set; } public string String2 { get; set; } public override int GetHashCode(...