Md5 hash or similar in SU Ruby?
-
I'm trying to find a hashing method similar to md5 in SU Ruby, but haven't found any.
Is there none?Anyone got any suggestions?
It's for generating unique IDs.
-
maybe start with http://betterexplained.com/articles/the-quick-guide-to-guids/
also TIG said sometime ago about using Time.now + random
-
I was thinking of using a timestamp + entityID. And I thought I'd try to hash it.
-
That GUID article looks like it will do the trick.
cheers!
-
Anyone has some info on what hashing method Ruby's String.hash uses?
I'm looking at using this:
"#{e.entityID}#{Time.now.to_i}".hash
- but I'm not sure if I should just skip the.hash
bit. -
There is a md5.so in the digest library. Don't know what Ruby digests are used for. (The CHM has no info.)
-
There was a link on the GUID article to a add-on Ruby UUID generator library.
http://raa.ruby-lang.org/project/uuid/
and th rubyforge page:
http://rubyforge.org/projects/reliable-msg/ -
Yea, I looked at that article. It seemed to require a few modules that doesn't ship with SU.
-
Hello!
I know this post is really old.
But for reference purposes, I found a pure Ruby implementation of MD5 there:
http://d.hatena.ne.jp/zakinco/20091030/p1Just copy the Purerubymd5 module in your script or a library file.
Purerubymd5.hexdigest("abc")
is then available from Sketchup Ruby. -
Personally I have just used a Ruby
%x
call using the fciv.exe command line checksum utility that I believe came with the Windows Support Tools.fciv stands for File Checksum Integrity Verifier:
Microsoft Download: File Checksum Integrity Verifier
Advertisement