Added Security::generateRandomHexKey(), used it for various tokens and default key generation

Fixes #4114.

Needs review.
It was made with str_shuffle :) we can use base_convert to achive that.