2021年6月22日 星期二

PHP uniqid() algorithm

uniqid() 是 PHP 內建用取唯一 id 的方法,它是 Time Base,官方不保證唯一,因為時間有可能會因為校時而異動
它組成分成兩部分,前面的部分單算單位是秒,後面的部分(最後5碼)計算單位是微秒(microsecond,10E-6秒)
例如 1624333020.999999
1624333020 十六進位是 60d15adc
999999 十六進位是 f423f
這個時間點的 uniqid() 就是 60d15adcf423f

沒有留言:

New SSH client to old SSH server

從新版 SSH 8.x 連到舊版 6.x SSH server 若出現 Unable to negotiate with x.x.x.x port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss ...