this is where you define rule engines to avoid the load to be pushed on the db server or unnecessary code on UI.
your solution (hashing) might not be a better alternative to the first one (according to your email) and I don't think if you end up with duplicate PKs. but you might having different records with different PKs but representing the same object. this is where you can use sequence in oracle or identity() in sql server to identify the object
most of the time you can let DB server to do the work by defining PK on columns. i.e. in sql server when you define a pk on multiple columns therefore the server will enforce uniqueness by generating unique index for the pk columns. creation of the index involves some kind of hashing and it is a reliable and efficient technique. this is irrespective of the types of the pks (string or integer) but if columns contain null the ok generation function can ignore the content and still construct a unique key
still even for small scale applications, you might consider some light-weigth rule engine approach,