Quick Editor - Generate Hashes

Hello Everyone,

I would like to share with you a quick script I wrote to generate md5 hashes for an inventory system I was writing. It was important for me to have these hashes for a few reasons.

1) The inventory system was linked to PlayerPrefs. I needed a non-integer way to represent the item.

2) I wanted to use some sort of hash to represent the item as it would prove very difficult for someone to cheat even by modifying PlayerPrefs.

3) The PlayerPrefs keys were also md5 hashes, making reading the PlayerPrefs file impossible.

In my case, I have an object tree with many GameObjects that represent the Items in my game. Each of these GameObjects have the BaseItem component, which holds the items stats an some utility functions.

It has a public string guid, variable which this editor script sets every-time I run it. As I create new items, I re-run the script which resets all of the guid variable to the md5 hash of its name.

Pretty simple and quick, and most importantly super effective.