use System.Security class Utils shared def randomHexString(length as int) as String """ Returns a cryptographically strong random hex string such as '43de3637ba024801'. """ require length > 0 and length % 2 == 0 ensure result.length == length bytes = uint8[](length // 2) Cryptography.RNGCryptoServiceProvider.create.getBytes(bytes) return BitConverter.toString(bytes).replace('-', '').toLower class Program def main print Utils.randomHexString(32)
Wiki