> Or is there a better way of doing it? One additional: using a hash algorithm does produce unique values in many cases but doesn't guarantee them. If uniqueness is an absolute requirement you have to check if a key already exists and generate another one in this case (using a different secret f.e.). Regards, Frank