initHexKey static method

String initHexKey()

生成随机的128位(16字节)AES十六进制密钥

返回结果: String 返回生成的16字节长度的十六进制密钥字符串

示例:

String aesKey = EncryptUtil.initHexKey();
print('AES密钥: $aesKey');

Implementation

static String initHexKey() {
  final key = Key.fromSecureRandom(128 ~/ 8);
  return HEX.encode(key.bytes);
}