Open Benjamin-Loison opened 1 month ago
https://www.php.net/manual/en/function.hash-algos.php
print_r(hash_algos());
https://www.php.net/manual/en/function.hash.php
echo hash('sha512', '');
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e
echo -n | sha512sum
cf83e1357eefb8bdf1542850d66d8007d620e4050b5715dc83f4a921d36ce9ce47d0d13c5d85f2b0ff8318d2877eec2f63b931bd47417a81a538327af927da3e -
date(DATE_ATOM)
We need millisecond precision, as 2 keys may be tested in a second.
The Stack Overflow answer 11424665 helps.
//use \Datetime;
$now = new DateTime();
echo $now->getTimestamp();
die();
If the key is removed, then its hash does not make me able to get the initial YouTube Data API v3 key.
function logg($filePath, $toWrite) {
$toWrite = floor(microtime(true) * 1000) . ' ' . $toWrite;
file_put_contents($filePath, $toWrite . "\n", FILE_APPEND);
}
logg('no_key_logs.txt', hash('sha512', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' . $key));
logg('../no_key_logs_secret.txt', "New key $key");
http://yt.lemnoslife.com/no_key_logs.txt
/var/www/no_key_logs_secret.txt
However, making people able to distinguish a key from another can interesting.
Note that an interesting metric is how many days it takes to loop on an already used key.
Having some anonymized logs to let people see people's usage and involved quota usage. However, have to ensure that requests do not leak any private information by specifying the shape of correct requests. If consider URLs it is not too much complicated to list all YouTube Data API v3 and YouTube operational API web-scraping endpoints, however for parameters it starts being annonying except if automatize.
It seems that the mutex is not actually exclusive.
cut -d ' ' -f 2 no_key_logs.txt | uniq | wc -l
helps.
https://discord.com/channels/933841502155706418/933841503103627316/1290273845143404565