@Test
    public void testGenerateSHA256() {

        // 256-bit key consisting of the bytes "12345678901234567890" repeated
        // as necessary
        final byte[] key = {
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
            '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
            '1', '2'
        };

        try {
            final TOTPGenerator totp = new TOTPGenerator(key, TOTPGenerator.Mode.SHA256, 8);
            assertEquals("46119246", totp.generate(59));
            assertEquals("68084774", totp.generate(1111111109));
            assertEquals("67062674", totp.generate(1111111111));
            assertEquals("91819424", totp.generate(1234567890));
            assertEquals("90698825", totp.generate(2000000000));
            assertEquals("77737706", totp.generate(20000000000L));
        }
        catch (InvalidKeyException e) {
            fail("SHA256 test key is invalid.");
        }

    }
Verifies the results of generating authentication codes using the TOTP
algorithm in SHA256 mode.
extensions/guacamole-auth-totp/src/test/java/org/apache/guacamole/totp/TOTPGeneratorTest.java