:godmode:

This commit is contained in:
smiley
2015-12-08 04:02:13 +01:00
parent 8671a6936a
commit e21a7da686
14 changed files with 678 additions and 883 deletions
+15 -8
View File
@@ -2,21 +2,28 @@
require_once '../vendor/autoload.php';
use codemasher\QRCode\QRCode;
use codemasher\QRCode\QRConst;
use chillerlan\QRCode\QRCode;
use chillerlan\QRCode\QRConst;
$starttime = microtime(true);
$qrcode = (new QRCode)
->setErrorCorrectLevel(QRConst::ERROR_CORRECT_LEVEL_M)
->setQRType(QRConst::TYPE_05)
;
// google authenticator
// https://chart.googleapis.com/chart?chs=200x200&chld=M%7C0&cht=qr&chl=otpauth%3A%2F%2Ftotp%2Ftest%3Fsecret%3DB3JX4VCVJDVNXNZ5%26issuer%3Dchillerlan.net
$qrcode
->setData('otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net')
->getRawData()
;
$qrcode = new QRCode('otpauth://totp/test?secret=B3JX4VCVJDVNXNZ5&issuer=chillerlan.net', QRConst::ERROR_CORRECT_LEVEL_M, 5);
for($row = 0; $row < $qrcode->moduleCount; $row++){
for($col = 0; $col < $qrcode->moduleCount; $col++){
echo (bool)$qrcode->modules[$row][$col] ? '#' : ' ';
for($row = 0; $row < $qrcode->pixelCount; $row++){
for($col = 0; $col < $qrcode->pixelCount; $col++){
echo $qrcode->matrix[$row][$col] ? '*' : ' ';
}
echo PHP_EOL;
}
echo 'QRCode '.round((microtime(true)-$starttime), 5).PHP_EOL;
echo 'QRCode: '.round((microtime(true)-$starttime), 5).PHP_EOL;