hash

Determining Perfect Hash Lookup Table for Pearson Hash

I'm developing a programming language, and in my programming language, I'm storing objects as hash tables. The hash function I'm using is Pearson Hashing, which depends on a 256-bit lookup table. Here's the function: char* pearson(char* name, char* lookup) { char index = '\0'; while(*name) { index = lookup[index ^ ...

Select a particular anchor element through location.hash

I'm trying to select a particular tab section of a web page, on clicking a link on another page. I was suggested to use the location.hash function to select that particular anchor element of the tab and add the hash property in the href attribute of the first web page. But the code doesn't work for me.I get the entire page,instead of th...

simple symmetric encryption of long to String (and back) in java

Hi, I'm looking for a simple way to translate long to String and back in a way that will "hide" the long value. I'd prefer to avoid adding another .jar to the project for this feature. It does not have to be a hard-to-crack encryption, just to look random to the inexperienced eye. Addition: My purpose here is to attach a counter val...

Using string object as a hash key in Common Lisp

Hi folks, I'm trying to create a "dictionary" type - ie hash table with a string as a key. Is this possible or wise in Lisp? I noticed that this works as expected: > (setq table (make-hash-table)) #<HASH-TABLE :TEST EQL size 0/60 #x91AFA46> > (setf (gethash 1 table) "one") "one" > (gethash 1 table) "one" However, the following does ...

If I make the SALT random for each user, how do I authenticate them?

I've been reading up on the benefits of salting and hashing passwords, but one thing still eludes me... When I provide a random salt for each user, how do I then know what the salt was when I try to authenticate them to login? so if I do.. HASHPW = PW.RANDOMNUMBER I could store the random number in the database, but that seems to k...

Distributing users (or anything else) to database servers by hash.

I'm working on early designs for an application that needs to start out small but be highly scalable. I'm particularly worried about the user database, which in this case will have a high INSERT and UPDATE load, and is unlikely to survive long on a single master. (Although my question isn't tied to any particular RDBMS, for the record, ...

How can I reproduce a SHA512 hash in C# that fits the PHP SHA512?

Hello :) The question is pretty much self-explanatory. I Googled many sites, many methods, tried many encodings, but I can't get it to match. I'm trying to make the string "asdasd" match. (http://www.fileformat.info/tool/hash.htm?text=asdasd) ...

Microsoft Symbol Server / Local Cache Hash Algorithm

Hi, I am trying to figure out what hashing algorithm is used for the Microsoft Symbol Local Cache directory. For example, the local cache can be something like the following L:\Symbols \browseui.dll \44FBC679fe000 browsue.dll \browseui.pdb \44F402F62 browseui.pdb \explorer.exe ...

Represent MD5 hash as an integer

Hello! In my user database table, I take the MD5 hash of the email address of a user as the id. Example: email([email protected]) = id(d41d8cd98f00b204e9800998ecf8427e) Unfortunately, I have to represent the ids as integer values now - in order to be able to use an API where the id can only be an integer. Now I'm looking for a way ...

Is a string comparison or a hash lookup faster in Perl?

I have some code that at one part will get executed a lot, and I'm wondernig which way is a more efficient implementation. I will use a for loop to simulate the part the gets executed alot: option A: my %sections = ( 'somestring1' => 1, 'somestring2' => 1, 'somestring3' => 1, 'somestring4' => 1 ); for (0..10000) { ...

Hash of an .exe file

I'm wondering whether I will ever get a different result when producing a checksum on an .exe file before and then while or after running that file. I'm more concerned with common practice (such as producing a SHA hash of popular app like firefox.exe) than with boundary cases, but both are interesting. Thanks. ...

Convert hash to a hexadecimal character string

on this page: http://www.shutterfly.com/documentation/OflyCallSignature.sfly it says once you generate a hash you then: convert the hash to a hexadecimal character string is there code in csharp to do this? ...

Facebook Connect Email hash function for vb.net

Does anyone have a working class or function to create the hashed email that is sent to facebook to register email addresses with connect.registerUsers? ...

add a hash with javascript to url without scrolling page?

add a hash to url without scrolling page? with javascript i open page i scroll down i click link that adds a hash (maybe with a value #test) (example: http://www.example.com/#test) the page MUST not scroll back to the top. how can this be done? note: just checking if it's possible to disable the movement even if there is some tag wi...

Safely loading a hash in Ruby

I want to load a data structure into a Ruby script which maps a string to a triple which contains some combination of regular expressions, scripts and atoms. The file that it loads from needs to be human writeable. Currently I'm writing the file to contain a Ruby hash, loading that as a string and calling eval. Ie. Data file { "key1" ...

What's the best way of hashing this complex structure in VB6?

I have the following structures defined (names are anonymised, but data types are correct): Public Type ExampleDataItem Limit As Integer ' could be any value 0-999 Status As Integer ' could be any value 0-2 ValidUntil As Date ' always a valid date End Type Public Type ExampleData Name As String ' could be 5-2...

Working with encrypted id

A Ticket has a integer ID. We decided users should not interact (see, enter as search parameter) the integer ID, because it is sequential, predictable. So the users should work with a encrypted ID. It should have eight chars, between letters and numbers, avoiding those who look like (0, o, 1, l, 5, s, u, v), and not being sequential. ...

Making a Hash from an array - how does this work?

fruit = ["apple","red","banana","yellow"] => ["apple", "red", "banana", "yellow"] Hash[*fruit] => {"apple"=>"red", "banana"=>"yellow"} Why does the splat cause the array to be so neatly parsed into the Hash? Or, more precisely, how does the Hash "know" that "apple" is the key and "red" is its corresponding value? Is it simply be...

PHP array with default value for nonexisting indices

I love the Hash implementation of Ruby where you can initialize the Hash object with a default value. At the moment I'm struggling with implementing a similar object in PHP. This is my first (non-working) shot at this. class DefaultArray extends ArrayObject { protected $_defaultValue; public function setDefault($defaultValue) { ...

Does partial known plaintext weaken a hash?

This is a question about an authentication scheme. Say I have a shared secret string S, and two computers, C1 and C2 Computer one (C1) sends a random string (R) to computer two (C2) C2 hashes (say SHA256) the concatenation of S and R (SR) C2 sends the hash of SR to C1, along with some instructions C1 compares the received hash of SR w...