Posts: 1,000
Threads: 253
Joined: Feb 2008
I'm working with images and I'm trying to think of the best way to avoid processing them multiple times.
My thought is to read the file and generate a hash of the content to create a filename based on that.
-Jim
Posts: 12,071
Threads: 140
Joined: Dec 2002
32-bit hash - Crc32(file 0 1)
128-bit hash - str.encrypt(2|8 file "" 0x100)
Posts: 1,000
Threads: 253
Joined: Feb 2008
I'm thinking I'll use DateTime + the first 4 characters from str HASH.encrypt(2|8 sPath "" 0x100) to return things like:
130210821264631349_543A.jpg
130210821265881565_655D.jpg
130210821267131781_0EFF.jpg
That's about as long as I want files names to be.
I also want to be able to sort by the original date created...so having that information in the filename is important.
Better ideas?
jim
Posts: 12,071
Threads: 140
Joined: Dec 2002
4 hex characters = 2 bytes = 65536 unique values.
4 bytes would be >4000000000 unique values. Crc32 creates a 4-byte hash.
Posts: 1,000
Threads: 253
Joined: Feb 2008
I don't know if I am getting the Crc32 to work
"out Crc32(sPath 4 1)" outputs like:
-1957881914
27141269
233437840
-551937856
same as "out Crc32(sPath 0 1)"
-1957881914
27141269
233437840
-551937856
Not sure what it is supposed to be like