AES 密钥在线生成器

写了一个密钥生成器,方便开发时生成随机的 AES 密钥使用,部署在 Azure 应用服务上面。

生成代码

keygen.php
1
2
3
4
5
6
7
8
9
function keygen($length) {
$token = '';
$tokenlength = round($length * 4 / 3);
for ($i = 0; $i < $tokenlength; ++$i) {
$token .= chr(rand(32, 1024));
}
$token = base64_encode(str_shuffle($token));
return substr($token, 0, $length);
}

From: https://github.com/gladchinda/keygen-php/blob/master/src/Keygen/Generators/TokenGenerator.php

选择密钥长度

生成结果

作者

iMaeGoo

发布于

2020-03-24

更新于

2023-03-16

许可协议

CC BY 4.0

评论