Created
April 25, 2016 03:43
-
-
Save asaph/df0c6487b3ec83a3c9ba1cfd6040bb1e to your computer and use it in GitHub Desktop.
Generate 6 digit 2fa codes in sync with Google Authenticator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String secretKey = "quu6 ea2g horg md22 sn2y ku6v kisc kyag"; | |
String lastCode = null; | |
while (true) { | |
String code = getTOTPCode(secretKey); | |
if (!code.equals(lastCode)) { | |
// output a new 6 digit code | |
System.out.println(code); | |
} | |
lastCode = code; | |
try { | |
Thread.sleep(1000); | |
} catch (InterruptedException e) {}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment