hash

How can I hash passwords in postgresql?

I need to hash some passwords with salt on postgresql, and I haven't been able to find any relevant documentation on how to get that done. So how can I hash passwords (with some salts) in postgresql? ...

How can I use a Perl hash key that has a literal dot?

I have a hash in Perl which has been dumped into from some legacy code the name of the key has now changed from simply reqHdrs to reqHdrs.bla $rec->{reqHdrs.bla} My problem is now I cant seem to access this field from the hash any ideas? The following is my error Download Script Output: Bareword "reqHdrs" not allowed while "strict su...

Boost MultiIndex - objects or pointers (and how to use them?)?

I'm programming an agent-based simulation and have decided that Boost's MultiIndex is probably the most efficient container for my agents. I'm not a professional programmer, and my background is very spotty. I've two questions: Is it better to have the container contain the agents (of class Host) themselves, or is it more efficient fo...

Using hash to check if page with $_POST values was refreshed

When posting a form to the same PHP page, what is the correct method to find if the page was accidentally refreshed instead of submitted again? Here's what I'm using right now: $tmp = implode('',$_POST); $myHash = md5($tmp); if(isset($_SESSION["myHash"]) && $_SESSION["myHash"] == $myHash) { header("Location: index.php"); // page ...

Sort files (strings) over 4 arrays

Hi there, I am after a function which will let me sort a bunch of filenames over 4 arrays. However, the a file must always end up in the same array - even if the number of files change. Eg if I have files myfile.html anotherfile.html morefiles.html test.html and my arrays array1, array2, array3, array4 If I run this function then ar...

Problem storing a hash in DB using Storable::nfreeze in Perl

I want to insert a hash in the db using Storable::nfreeze but the data is not inserted properly. My code is as follows: %rec=(); $rec{'name'} = 'my name'; $rec{'address'} = 'my address'; my $order1 = new Order(); $order1->set_session(\%rec); $self->createOrder($order1); sub createOrder { my $self = $_[0]; my $order = $_[1]; # Retr...

using Multi Probe LSH with LSHKIT

Hi Guys, I have read through the source code for mplsh, but I still unsure on how to use the indexes generated by lshkit to speed up the process in comparing feature vector in Euclidean Distance. Do you guys have any experience regarding this? ...

How to map string keys to unique integer IDs?

I have some data that comes regularily as a dump from a data souce with a string natural key that is long (up to 60 characters) and not relevant to the end user. I am using this key in a url. This makes urls too long and user unfriendly. I would like to transform the string keys into integers with the following requirements: The source...

Question about the mathematical properties of hashes

Take a commonly used binary hash function - for example, SHA-256. As the name implies, it outputs a 256 bit value. Let A be the set of all possible 256 bit binary values. A is extremely large, but finite. Let B be the set of all possible binary values. B is infinite. Let C be the set of values obtained by running SHA-256 on every memb...

What a robust and easy way to encrypt a string with key without using Open SSL?

I don't want to use Open SSL or any very big none-built-in libraries for this. I only want to be able to encrypt a string with a key so you can't decrypt it without it. By the way, i already did a long search on stackoverflow and i've checked out those unsecure ways but i want something robust like md5 (which can be decrypted with a ke...

How to Iterate in ruby ?

Hi I would like to iterate @some_value outputs the following result {"Meta"=>{"Query"=>"java", "ResultOffset"=>"1", "NumResults"=>"1", "TotalResults"=>"21931"}} i need to retrieve the Value of each individual value for example java 1 1 21931 ...

Get url from iframe and update hash in browser url

I've tried a few different things but nothing really worked, basically i need to get the current location/url from the iframe, get the part i want and return it to the hash in the url. how can i do this in javascript? ...

Hashable, immutable

From a recent SO question (see http://stackoverflow.com/questions/2671211/create-a-dictionary-in-python-which-is-indexed-by-lists) I realized I probably had a wrong concept of the meaning of hashable and immutable objects in python. What hashable means in practice?, What the relation between hashable and immmutable is? There are mutab...

Removing duplicates without overriding hash method

Hello, I have a List which contains a list of objects and I want to remove from this list all the elements which have the same values in two of their attributes. I had though about doing something like this: List<Class1> myList; .... Set<Class1> mySet = new HashSet<Class1>(); mySet.addAll(myList); and overriding hash method in Class1...

How can I check if a value is in a list in Perl?

I have a file in which every line is an integer which represents an id. What I want to do is just check whether some specific ids are in this list. But the code didn't work. It never tells me it exists even if 123 is a line in that file. I don't know why? Help appreciated. open (FILE, "list.txt") or die ("unable to open !"); my @da...

Where to find LM-Hashes

Hi, are there any other places besides the SAM file? Are LM-Hashes used in any procotols, so they can be found by scanning the network traffic? Thanks ...

Using a password to generate two distinct hashes without reducing password security

Hi there, I'm in the process of designing a web application that will require the storage of GPG keys in an encrypted format in a database. I'm planning on storing the user's password in a bCrypt hash in the database. What I would like to be able to do is to use that bCrypt to authenticate the user then use the combination of the stored...

Ruby: How come the same strings have different hashcodes?

test = 'a' test2 = '@a'.slice(0) test3 = '@a'[1] puts test.hash puts test2.hash puts test3.hash Output: 100 64 97 Is this a bug or am I misunderstanding how the hash method works? Is there a way to fix this? ...

Python hash() can't handle long integer?

I defined a class: class A: ''' hash test class >>> a = A(9, 1196833379, 1, 1773396906) >>> hash(a) -340004569 This is weird, 12544897317L expected. ''' def __init__(self, a, b, c, d): self.a = a self.b = b self.c = c self.d = d def __hash__(self): return self.a ...

Hash default value not being used

Today I tried the following snippets of code and I don't understand why I get different results between them. As far as I can understand they are the same. One uses the default value off Hash and the other snippet creates an empty array for the key before it'll be accessed. Anyone who understands what's going on? :) # Hash default if ...