hash

passing hash object values as search parameter

I have a table "Email" with field "contents" where the data are stored as hash object. I want to do search in this table with parameter "email => [email protected]" where :email is key and "[email protected]" is value of a hash object. Thanks in advance ...

How do I empty a Perl hash?

Possible Duplicate: How can I reset a hash completely without using a for loop? How do I empty a hash in Perl? I've got a code like this: my %hash; while (some_condition) { # do something if (deleting_condition) { # empty %hash } } My first idea was %hash={};, but this gives the hash a single value with ...

HTTP URL token standard

I need to develop a feature in the system which allows unregistered users to get one-off system access via URL token that is generated/sent by an authenticated user. For example, a user logs in and wants to share a piece of information so the system generates a URL like http://host/page?token=jkb345k4b5234k54kh5345kb34kb34. Then this UR...

How do I create this multidemsional Array, Hash Combo?

I have this data and i need an output like this type of output.. I basically need to have all the venues and their dates and all the songs associated to them ....if anyone can think of a better structure and how to achieve it I would be very thankful... { ["Vector Arena - Auckland Central, New Zealand" => { "2010-10-10" => ["...

What's the best practise for Perl hashes with array values?

What is the best practise to solve this? if (... ) { push (@{$hash{'key'}}, @array ) ; } else { $hash{'key'} =""; } Is that bad practise for storing one element is array or one is just double quote in hash? ...

There has got to be a cleaner way to do this...

I have this code here and it works but there has to be a better way.....i need two arrays that look like this [ { "Vector Arena - Auckland Central, New Zealand" => { "2010-10-10" => [ "Enter Sandman", "Unforgiven", "And justice for all" ] } }, { "Brisbane Entertainment Centre - Brisbane Qld, Aus...

Unordered (hash) map from bitset to bitset on boost

Hello, I want to use a cache, implemented by boost's unordered_map, from a dynamic_bitset to a dynamic_bitset. The problem, of course, is that there is no default hash function from the bitset. It doesn't seem to be like a conceptual problem, but I don't know how to work out the technicalities. How should I do that? Thanks. ...

Password security: sha1, sha256 or sha512

Hi, After knowing that hashing a password is my choice for making a login form. Now I am facing another issue - sha1, sha256 or sha512? This is a standard method using salt I think I got it from a reference book of mine, # create a salt using the current timestamp $salt = time(); # encrypt the password and salt with SHA1 $usr_passwor...

Datastructures, C#: ~O(1) lookup with range keys?

I have a dataset. This dataset will serve a lookup table. Given a number, I should be able to lookup a corresponding value for that number. The dataset (let's say its CSV) has a few caveats though. Instead of: 1,ABC 2,XYZ 3,LMN The numbers are ranges (- being "through", not minus): 1-3,ABC // 1, 2, and 3 = ABC 4-8,XYZ // 4, ...

Perl: Template for an anonymous array?

I have a Perl script to analyze many megabytes of data line-by-line. As an example, I will use the close of the Dow Jones Average by day for several lines. The data is read and the layout of the data in the file is straightforward. In this example, it is: Date Open High Low Close Volume Adj-Close As I read the data, many calculation...

jquery - ajax application - multiple hashes?

So some web apps I've made have little "features" of ajax. Simple things usually, so I've only ever needed one hash (e.g. example.com/products#shirts). What if I wanted to have the "products" page loaded through ajax too? I know that it doesn't need to be in the hash, but for some functionality I prefer it (for user history and following...

Weird behaviour of MD5 hashing

Dear all, I have faced aweird problem with the following code, the code below suppose to stop after one iteration, but it just keep going. However, if I remove the last "result_bytes = md5.ComputeHash(orig_bytes);" then it will work. Does anyone face similar problem before? MD5 md5; byte[] orig_bytes; byte[] res...

Good hash function for list of 2-d positions?

Hi! I have a series of objects whose only different internal state is a fixed-length list(or whatever) of 2-d positions (2 integers). That is, they all have the same number of elements, with (potentially) different 2-d values. I'm going to be constantly comparing new instances against all previously existent, so it's very important tha...

Android - how to encrypt a string?

I am working on an Android app and have a couple strings that I would like to encrypt before sending to a database. I'd like something that's secure, easy to implement, will generate the same thing every time it's passed the same data, and preferably will result in a string that stays a constant length no matter how large the string bei...

Looking for a network-accessible hash table

I have a data acquisition application broken into a client and a server. The server is reponsible for grabbing data from the hardware, running some realtime analysis, and recording the data to disk when it's asked. The client is a GUI that the operator can use to look at some pretty graphs (generated by the server), set some parameters...

Is there a glibc hash function?

Hey, I'm looking to do a custom hash table implementation in C. Is there an MD5/SHA1 hash function already in the GNU library or do I have to use an external library for this? Here's kinda what I'm looking for: int hashValue; hashValue = MD5_HASH(valToHash); ...

What is the standard way to create a "key" from a value?

Hi, I need to take a user's email address and somehow manipulate the value to come up with an auto-generated password. I want to make sure that I can re-create the same password whenever a user needs to retrieve their password. Is there a standard way of doing this? Is this what a "hash" is? I would be greatly appreciative if someone c...

How do I access keys by value in a Perl hash of hashes?

I've hash of hash like this: $hashtest{ 1 } = { 0 => "A", 1 => "B", 2 => "C" }; For example, how can I take the value of B of hash{ 1 }? $hashtest{'B'}{1} ...

implementation of hash table

i have following code #include <stdio.h> #include <iostream> #include <algorithm> #include <string.h> #include <hash_map> #include <string> #include <iterator> #include <ostream> using namespace std; struct Equal { bool operator()(const char *s1,const char *s2)const { return std::strcmp(s1,s2)==0; } }; ...

How to switch hash_algos() on ? I'm with Php 5.2.11

My PHP version is 5.2.11 which is higher than the required version for hash_algos. however, when I run it either via web or command line, it returns Fatal error: Call to undefined function hash_algos() So as for other Hash functions. Do i have to turn anything on in the php.inin or what should I do? I have checked the php --re has...