Thursday, March 15, 2007

Sometimes you just need some Hash(es)

James Manning's blog - get-hashes.ps1: Get the hashes (sha256, md5, whatever) for a file

"A slight modification of Mike's version, since sometimes I want md5, sometimes sha1, whatever, and I happen to like the '-' separators :)  I think sha256 makes a good default, though. 

The other differences are style related and just my personal preference:

  1. optimize for reading instead of writing (I've written and read enough perl in my life to know that it takes effort to make for readable scripts in such a language :)
  2. use scripts instead of functions so you can just add them to your script collection
  3. provide types for your arguments if you require them to be a specific type
  4. check that required arguments are passed

..."

Sorry about the title... It's one of those juvenile jokes in my team (hehehe.. he said "hash"...)

Anyway... This, because of the many hashing algorithms it supports, may come in handy in the future.

No comments: