public static byte[] createSaltedPassword(byte[] salt, String password, int iters) throws SaslException {
        Mac mac = createSha1Hmac(password.getBytes(StandardCharsets.UTF_8));
        mac.update(salt);
        mac.update(new byte[]{0, 0, 0, 1});
        byte[] result = mac.doFinal();

        byte[] previous = null;
        for (int i = 1; i < iters; i++) {
            mac.update(previous != null ? previous : result);
            previous = mac.doFinal();
            for (int x = 0; x < result.length; x++) {
                result[x] ^= previous[x];
            }
        }

        return result;
    }
@Test
    public void testCreateSaltedPassword() throws Exception
    {
        // Setup test fixture.
        final byte[] salt = StringUtils.decodeHex("4125c247e43ab1e93c6dff76");
        final String password = "pencil";
        final int iterations = 4096;

        // Execute system under test.
        final byte[] result = ScramUtils.createSaltedPassword(salt, password, iterations);

        // Verify results.
        assertArrayEquals(StringUtils.decodeHex("1d96ee3a529b5a5f9e47c01f229a2cb8a6e15f7d"), result);
    }