-
Notifications
You must be signed in to change notification settings - Fork 4
Secret Creation Methods
Đorđe Jocić edited this page Jan 2, 2019
·
1 revision
Secret can be generated using two different methods:
- Base Method - Random values from the base table are picked until an 80-bit value is formed.
- Numerical Method - Random numbers, ranging from 0 to 256, are generated until an 80-bit value is formed.
- Binary Method - Random bits are chosen until an 80-bit value is formed.
The base method is used by default, so you need not specify it. However, if something is compelling you to do otherwise, Satan for example, you can use the following snippet.
use Jocic\GoogleAuthenticator\Secret;
$secret = new Secret();
echo $secret->generateValue(Secret::M_BASE);
To generate a secret using the numerical method, use the following snippet.
use Jocic\GoogleAuthenticator\Secret;
$secret = new Secret();
echo $secret->generateValue(Secret::M_NUMERICAL);
And finally, following snippet can be used for generating a secret using the binary method.
use Jocic\GoogleAuthenticator\Secret;
$secret = new Secret();
echo $secret->generateValue(Secret::M_BINARY);