[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: CRC32 module?
- From: Rob Kendrick <lua-l@...>
- Date: Mon, 07 Feb 2005 13:30:46 +0000
On Feb 07, 2005, at 11:56, Luiz Henrique de Figueiredo wrote:
Do you really need CRC32?
Doesn't MD5 or SHA1 work for you?
Yes. But for different purposes.
For example, lets assume I want to build an URL pointing to some data of
some sort. The data are uniquely identified by a time based UUID:
A md5 of an uuid is still quite long and obscure:
So... what I would like to do instead is to build an URL which reflects
the UUID time, plus a short hash to identity the data in that time frame:
Therefore the need for some predictable hashing of some sort. CRC32
comes to mind. But any sort of hashing would do. Doesn't Lua itself have
some kind of hashing function for strings?
This'd make me very uneasy - it's too easy to predict CRCs, which may
lead to a security flaw later on. A better choice would be to just take
the first 6 characters of a SHA1 or similar.