Well, I was confused about how you were confused. I guess you're saying the HMAC makes 32 printable characters, and this would be because it is being translated fron binary into hex. What I was trying to say is that if the hash makes k binary output bits, it is easy to fold them together with something like XOR to get k/2, k/4, k/8 bits, etc.
But what I did not fully appreciate is that this needs to be done BEFORE the translation from binary to printable happens.
If you cannot get the HMAC function to return the binary, you could always convert BACK from hex to binary, do the XOR, then convert the resulting shorter string forward to hex again.
Hope this makes some sense.
BTW all David's suggestions are good ones. The time stamp occured to me after I initially answered you. I didn't think about the IP address, and I guess I assumed you weren't up to putting up a central server. I didn't think of the software serial number, but it now occurs to me that you could use a CPU serial number if it is available, or the burned-in hardware Ethernet MAC address of an Ethernet interface (if you have one) since those are also supposed to be globally unique. Sorry, I don't trust the 512 bit random number approach, not because I doubt David's statistical maturity, but because I think generating a REALLY random number is a LOT more difficult than it sounds.
You might be suprised at the success penetration workers have had by PREDICTING the next random number that the machine is going to base its security on...
Michal Hlavac wrote:
Charles B Cranston wrote:
You could split into two 16-character pieces and then XOR the two pieces against each other.
hmmm... but result of substr(hmac, 0, 16) ^ substr(hmac, 16, 16) is not human readable code... Do you think, that xor is right way???
for example hmac: 750c783e6ab0b503eaa86e310a5db738
$result = 750c783e6ab0b503 ^ eaa86e310a5db738;
$result contains chr(0) characters...
thanx...
-- Charles B (Ben) Cranston mailto: [EMAIL PROTECTED] http://www.wam.umd.edu/~zben
______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]
