In vb.net is there a way to hash strings into long

Go To StackoverFlow.com

-1

Basically we want to preserve memories. It's for tasks like making unique of large files.

2012-04-04 04:48
by user4951
There are infinite ways to hash a string into a long. What have you tried? What problems are you having? Have you tried googling "vb.net " - Corbin 2012-04-04 04:51
yea, what? md5 hash would has a string into a byte () - user4951 2012-04-04 04:52
You can convert an array of bytes into a long. However, most hashing algorithms create a hash too large to fit in a single long. What is wrong with an array of bytes - Corbin 2012-04-04 04:53
Basically, I can tolerate that several different strings are hashed into the same long. The file is large, so I want to minimize memory usage as much as possible - user4951 2012-04-04 04:55
A long is 64 bits in VB.net, if I remember correctly. An md5 hash is 128 bits. That's not much of a difference in the big scheme of things. I'm sure there's some hashing algo out that that produces a hash <= 64 bits - Corbin 2012-04-04 04:57
Actually GetHashCode will convert that to integer, which is 32 bit. Good enough. I thought md5 is long string - user4951 2012-04-04 05:07
Okay, say I use md5, which is 128 bit. How to compare that the has is already around - user4951 2012-04-04 06:51
Ah I get it. Hmm.. gethashcode will give you an integer hash. While that's fine a normal long has would work too - user4951 2012-04-04 07:14


0

object.GetHashCode

That's it. Integer is good enough.

2012-04-04 05:57
by user4951
Ads