@Test
    public void testGenerateSHA512() {

        // 512-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', '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', '3', '4'
        };

        try {
            final TOTPGenerator totp = new TOTPGenerator(key, TOTPGenerator.Mode.SHA512, 8);
            assertEquals("90693936", totp.generate(59));
            assertEquals("25091201", totp.generate(1111111109));
            assertEquals("99943326", totp.generate(1111111111));
            assertEquals("93441116", totp.generate(1234567890));
            assertEquals("38618901", totp.generate(2000000000));
            assertEquals("47863826", totp.generate(20000000000L));
        }
        catch (InvalidKeyException e) {
            fail("SHA512 test key is invalid.");
        }

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