hash

Not getting a sha1 match in my C# to PHP code conversion, what am I missing?

I'm trying to understand this so I can do something similar. I know: buf contains an authentication key with a hash appended to it (the last 20 bytes) The HashData that's being looked up in the MachineKeySection is SHA1 length -= 20; byte[] buffer2 = MachineKeySection.HashData(buf, null, 0, length); for (int i = 0; i < 20; i++) { ...

How do I enumerate JvMemoryData...Or, how do I create a hash with a single key and multiple values?

I am using JvMemoryData to populate a JvDBUltimGrid. I'm primarily using this JvMemoryData as a data structure, because I am not aware of anything else that meets my needs. I'm not working with a lot of data, but I do need a way to enumerate the records I am adding to JvMemoryData. Has anyone done this before? Would it be possible to so...

Why do I get wrong results for hmac in Python but not Perl?

I'm trying to compute hmac using sha-512. The Perl code: use Digest::SHA qw(hmac_sha512_hex); $key = "\x0b"x20; $data = "Hi There"; $hash = hmac_sha512_hex($data, $key); print "$hash\n"; and gives the correct hash of 87aa7cdea5ef619d4ff0b4241a1d6cb02379f4e2ce4ec2787ad0b30545e17cde daa833b7d6b8a702038b274eaea3f4e4be9d914eeb6...

Writing a JavaScript zip code validation function

I would like to write a JavaScript function that validates a zip code, by checking if the zip code actually exists. Here is a list of all zip codes: http://www.census.gov/tiger/tms/gazetteer/zips.txt (I only care about the 2nd column) This is really a compression problem. I would like to do this for fun. OK, now that's out of the w...

What is the best way to get the hash of a QPixmap?

I am developing a graphics application using Qt 4.5 and am putting images in the QPixmapCache, I wanted to optimise this so that if a user inserts an image which is already in the cache it will use that. Right now each image has a unique id which helps optimises itself on paint events. However I realise that if I could calculate a hash...

Storing SHA1 hash values in MySQL

Hi. I have a simple question which occured when I wanted to store the result of a SHA1 hash in a MySQL database: How long should the VARCHAR field be in which I store the hash's result? ...

How do I sha1 hash hex values correctly in PHP?

I have a series of hex bytes. Theoretically, the last 20 bytes are the sha1 hash of the first part: 3F F4 E5 25 98 20 52 70 01 63 00 68 00 75 00 79 00 69 00 00 00 74 28 96 10 09 9D C9 01 00 74 A0 D7 DB 0B 9D C9 01 4D 00 79 00 47 00 72 00 6F 00 75 00 70 00 00 00 2F 00 00 00 BD 0D EA 71 BE 0B 25 75 E7 5C 58 20 31 57 F3 9A EF 69 1B FD If...

How is the machineKey validationKey used when creating a sha1 hash?

<machineKey validation="SHA1" validationKey="<64-byte key>" What exactly does the validationKey do? Say I create a hash with SHA1. How does the validationKey play in to it? Consider this code: HMACSHA1 hashSha = new HMACSHA1(_validationKey); byte[] ret = hashSha.ComputeHash(bytes, offSet, count); return ret; We are generating a new...

Purposely create two files to have the same hash?

If someone is purposely trying to modify two files to have the same hash, what are ways to stop them? Can md5 and sha1 prevent the majority case? I was thinking of writing my own and I figure even if I don't do a good job if the user doesn't know my hash he may not be able to fool mine. What's the best way to prevent this? ...

I have the wrong hash values? C# Cryptography

My text file says The quick brown fox jumps over the lazy dog, however when i try to get the hash from this file both the md5 and sha1 is different from the wikipedias result. I have 3 questions. 1) What did i do wrong in the code? 2) How can i have this piece of code better? (do i need the Initialize) 3) How do i salt this? { ...

Hash and salt

I remember a guy telling me that if i let him change 4 bytes he can make a file have any checksum he wants (crc32). I heard mention of salting a hash. I am wondering if someone had his file match my file would salting the md5 or sha1 hash change the result so both files no longer collide? or does it change the end hash value only? ...

What hashes are common hashes? used on the net and other programs?

I seen MD5 and SHA1 hashes on the net to verify files. What are common hashes used on the net and other programs? This is to verify a file not to hash a pw. ...

Fastest Sha1 Function (Linux, up to 2GB files)

Is there any linux command line implementation that performs exceptionally well for generating sha1's on large files (< 2GB)? I have played around with 'openssl sha1' and it takes minutes to get the sha1 for a 2GB file : /. ...

How does one store password hashes securely in memory, when creating accounts?

Our web-based applications has user accounts tied down to users with the passwords specified during account creation. In the case of Java, how does one process the password securely, before persisting its hash in the database. To be more specific, how does one ensure that the string holding the password is garbage collected within a suf...

Hashing for sparse bit vectors

Does anyone have any good intuition for a good hash function for a sparse bit vector? To give a concrete example, say I want to hash a 4096 bit integer where the probability of each bit being 1 is 10%. I want to get some compression in the hash. For example 4096 bits in and 32 bits out. This is just an example to illustrate what I am lo...

Good way to hash a float vector?

I am well aware of all the problems involved in comparing floats. This is exactly the reason for this question. I'm looking to create a fast hash table for values that are 3D vectors (3 floats - x,y,z). It can be assumed that the length of the vector is always 1.0 (sqrt(x*x+y*y+z*z) is 1.0) Essentially this means that I'm looking for ...

Python Hash Functions

What is a good way of hashing a hierarchy (similar to a file structure) in python? I could convert the whole hierarchy into a dotted string and then hash that, but is there a better (or more efficient) way of doing this without going back and forth all the time? An example of a structure I might want to hash is: a -> b1 -> c -> 1 -> d...

Why is this publicly accessible in my example: "MySymbol::TABLE"

class MySymbol TABLE={} def initialize(str) @str = str end def to_s() @str end def ==(other) self.object_id == other.object_id end end class String def my_intern table = MySymbol::TABLE unless table.has_key?(self) table[self] = MySymbol.new(self) end table[self] end end "foo".my_intern In the e...

Is it faster to search for a large string in a DB by its hashcode?

If I need to retrieve a large string from a DB, Is it faster to search for it using the string itself or would I gain by hashing the string and storing the hash in the DB as well and then search based on that? If yes what hash algorithm should I use (security is not an issue, I am looking for performance) If it matters: I am using C# a...

Url Hash with Html Base Tag

window.location.hash When using a link for a javascript action, I usually do something like this: <a href="#">Link Text</a> That way, when someone clicks the link before the page loads nothing terrible happens. Html Base Tag On my current project I use this same construct, but with a base tag: <html> <head> <base href="http://...