I am trying to generate equivalent MD5 hashes in both JavaScript and .Net. Not having done either, I decided to use against a third party calculation - this web site for the word "password". I will add in salts later, but at the moment, I can't get the .net version to match up with the web site's hash:
5f4dcc3b5aa765d61d8327deb882cf99...
Up until recently, I've been storing multiple values into different hashes with the same keys as follows:
%boss = (
"Allan" => "George",
"Bob" => "George",
"George" => "lisa" );
%status = (
"Allan" => "Contractor",
"Bob" => "Part-time",
"George" => "Full-time" );
and then I can reference $boss("Bob") a...
i thought i understood what the default method does to a hash...
give a default value for a key if it doesn't exist
irb(main):001:0> a = {}
=> {}
irb(main):002:0> a.default = 4
=> 4
irb(main):003:0> a[8]
=> 4
irb(main):004:0> a[9] += 1
=> 5
irb(main):005:0> a
=> {9=>5}
all good.
but if i set the default to be a empty list, or empty...
Basically what I'm trying to do is create an object of unique objects, a set. I had the brilliant idea of just using a JS object with objects for the property names. Such as,
set[obj] = true;
This works, to a point. It works great with string and numbers, but with other objects, they all seem to "hash" to the same value and access the ...
When creating a web application that some how displays the display of a unique identifier for a recurring entity (videos on YouTube, or book section on a site like mine), would it be better to use a uniform length identifier like a hash or the unique key of the item in the database (1, 2, 3, etc).
Besides revealing a little, what I thin...
I want to generate unique filenames per image so I'm using MD5 to make filenames.Since two of the same image could come from different locations, I'd like to actually base the hash on the image contents. What caveats does this present?
(doing this with PHP5 for what it's worth)
...
Hi,
(under asp.net enviro)
I will be sending data to a central server via a web service, and I want to hash the data to ensure that it didn't get corrupted during transfer.
Which hash method should I use?
Can I hash when the web service is passing objects?
...
So I was wondering if there are any major differences between the various implementations of the hash algorithms, take the SHA series of algorithms for example. All of them have 3 implementations each, 1 in managed code and 2 wrappers around different native crypto APIs, but are there any major differences between using any of them? I ca...
My Win form app doesn't seem to like FormsAuthentication, I'm totally new to hashing so any help to convert this would be very welcome. Thanks.
//Write hash
protected TextBox tbPassword;
protected Literal liHashedPassword;
{
string strHashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPassword.Text, "sha1");
...
I am building authentication into a client-server application, and some of the feedback I've received is that I should leave the hash calculation to the server (it was initially implemented to have the client receive the hash, calculate a hash from the client's entered password, and compare them). That seems to make sense, but I am left...
I don't need this, obviously; I'm just curious about what's going on here. Am I missing
something simple? Can I rely on this behaviour in all versions of Perl?)
Perl v5.8.8:
%h = ( 0=>'zero', 1=>'one', 2=>'two' );
while ($k = each %h) {
$v = delete $h{$k};
print "deleted $v; remaining: @h{0..2}\n";
}
outputs
deleted one; rem...
Yes, I know you could use regular objects as associative arrays in JavaScript, but I'd like to use something closer to java's Map's implementation (HashMap, LinkedHashMap etc). Something that could have any kind of data used as key. Are there any good hash(code/table) in JavaScript implementation out there?
...
Suppose a database table has a column "Name" which is defined as key for the table.
Usual name values will be "Bill", "Elizabeth", "Bob", "Alice". Lookups on the table will be done by the name key as well.
Does hashing the values optimize the operations in any way? i.e. entering each name as some hashed value of the name (suppose MD5 - ...
Given the following file:
department=value1
location=valueA
location=valueB
department=value2
I use the following to load the file into a Perl hash:
use File::Slurp;
use Data::Dumper;
my %hash = map {
s/#.*//;
s/^\s+//;
s/\s+$//;
m/(.*?)\s*=\s*(.*)/;
} read_file($file);
print Dumper(\%hash);
The result, however, is as f...
Can someone explain how PHP implements associative arrays? What underlying data structure does PHP use? Does PHP hash the key and store it in some kind of hash map? I am curious because I was wondering what the performance of associative arrays where when inserting and searching for keys.
...
What would be the best hashing algorithm if we had the following priorities (in that order):
Minimal hash collisions
Performance
It doesn't have to be secure. Basically I'm trying to create an index based on a combination of properties of some objects. All the properties are strings.
Any references to c# implementations would be app...
Hi all,
Let's make this very easy. What I want:
@array = qw/one two one/;
my @duplicates = duplicate(@array);
print "@duplicates"; # This should now print 'one'.
Thanks =)
...
I'm trying to figure out if there's a reasonably efficient way to perform a lookup in a dictionary (or a hash, or a map, or whatever your favorite language calls it) where the keys are regular expressions and strings are looked up against the set of keys. For example (in Python syntax):
>>> regex_dict = { re.compile(r'foo.') : 12, re.c...
I know that php has md5(), sha1(), and the hash() functions, but I want to create a hash using the MySQL PASSWORD() function. So far, the only way I can think of is to just query the server, but I want a function (preferably in php or Perl) that will do the same thing without querying MySQL at all.
For example:
MySQL hash -> 464bb2cb3...
I'm writing a simple C++ class in which I would like cache picture thumbnails versions of images downloaded from the web. As such, I would like to use a hash function which takes in URL strings and outputs a unique string suitable as a filename.
Is there a simple way to do this without re-writing the function myself? I searched around...