W
WTH
Hi everybody! (Hi Dr. Nick!)
I've got an applet that sends long strings (usually between 30 and 512
characters - but potentially up to 2048) via HTTP that represent
resource requests to my server (not the web server in this instance, a
TCP/IP server I've written to handle these resource requests) which is
running on the same machine as the web server. These resource
requests boil down to an individual file whose URL needs to be sent
back to the applet so it can download it.
The server (written in C++) needs to identify that request and
associate it with a previous request which has been fulfilled for
another client applet most likely in the past. If it has never had a
request exactly like this one, the server creates the required
resource and stores is on the web server and sends back the URL to the
client applet who then downloads the resource from the web server.
This approach works great for me and is scalable in the manner which I
currently require.
Because the incoming string can be really long and filled with all
kinds of 'filename unfriendly' characters, I simply hash the incoming
string and use that hash to identify if the resource already exists or
needs to be created (If a file with the same name as the hash already
exists, I've handled this exact request before and I send back the URL
to the file - otherwise, create the resource, name the file with the
hash, and send back the URL to the file.)
My initial implementation was under sever time pressure so the applet
didn't do the smart thing and figure out what the hash was and look on
the server without contacting the TCP/IP server - it just always
contacted the TCP/IP server and asked for the resource.
Now, I'd like to move the hashing into the applet to avoid that
potentially unnecessary communication with the server.
The implementation in the server is an RSA's AES implementation
(provided through the operating system) and using the 256-bit SHA
hashing algorithm.
So, after all the introductions, we get to the meat of the issue:
I need to implement this in JAVA 1.1 (yes, we have to support that far
back - 1.1.8 to be exact) and the MSJVM - we are an equal opportunity
group .
Anyone know of books/articles/samples that show how to hash long
strings to something comparable to 256-bit hash? It needs to be
usable as a filename, perfectly fine to be a one-way hash, and handle
2048 character strings (worst case) without collisions (or at least
very very very remote chances of collision - in the tens of millions.)
Am I missing some simpler method like CRC32 or something that I
discarded out of hand as being too prone to collisions without
understanding the math, et cetera...?
Very much appreciated,
WTH
I've got an applet that sends long strings (usually between 30 and 512
characters - but potentially up to 2048) via HTTP that represent
resource requests to my server (not the web server in this instance, a
TCP/IP server I've written to handle these resource requests) which is
running on the same machine as the web server. These resource
requests boil down to an individual file whose URL needs to be sent
back to the applet so it can download it.
The server (written in C++) needs to identify that request and
associate it with a previous request which has been fulfilled for
another client applet most likely in the past. If it has never had a
request exactly like this one, the server creates the required
resource and stores is on the web server and sends back the URL to the
client applet who then downloads the resource from the web server.
This approach works great for me and is scalable in the manner which I
currently require.
Because the incoming string can be really long and filled with all
kinds of 'filename unfriendly' characters, I simply hash the incoming
string and use that hash to identify if the resource already exists or
needs to be created (If a file with the same name as the hash already
exists, I've handled this exact request before and I send back the URL
to the file - otherwise, create the resource, name the file with the
hash, and send back the URL to the file.)
My initial implementation was under sever time pressure so the applet
didn't do the smart thing and figure out what the hash was and look on
the server without contacting the TCP/IP server - it just always
contacted the TCP/IP server and asked for the resource.
Now, I'd like to move the hashing into the applet to avoid that
potentially unnecessary communication with the server.
The implementation in the server is an RSA's AES implementation
(provided through the operating system) and using the 256-bit SHA
hashing algorithm.
So, after all the introductions, we get to the meat of the issue:
I need to implement this in JAVA 1.1 (yes, we have to support that far
back - 1.1.8 to be exact) and the MSJVM - we are an equal opportunity
group .
Anyone know of books/articles/samples that show how to hash long
strings to something comparable to 256-bit hash? It needs to be
usable as a filename, perfectly fine to be a one-way hash, and handle
2048 character strings (worst case) without collisions (or at least
very very very remote chances of collision - in the tens of millions.)
Am I missing some simpler method like CRC32 or something that I
discarded out of hand as being too prone to collisions without
understanding the math, et cetera...?
Very much appreciated,
WTH