         ]
 
         for (algorithm, values) in expectedValues {
-            let generator = Generator(factor: .Timer(period: 30), secret: secret, algorithm: algorithm, digits: 6)
             for (var i = 0; i < times.count; i++) {
                 let counter = UInt64(NSTimeInterval(times[i]) / 30)
-                XCTAssertEqual(values[i], generatePassword(generator.algorithm, generator.digits, generator.secret, counter),
+                XCTAssertEqual(values[i], generatePassword(algorithm, 6, secret, counter),
                     "Incorrect result for \(algorithm) at \(times[i])")
             }
         }


        for (algorithm, secretKey) in secretKeys {
            let secret = secretKey.dataUsingEncoding(NSASCIIStringEncoding)!
            let generator = Generator(factor: .Timer(period: 30), secret: secret, algorithm: algorithm, digits: 8)

            for (var i = 0; i < times.count; i++) {
                if let password = expectedValues[algorithm]?[i] {
                    let counter = UInt64(times[i] / 30)
                    XCTAssertEqual(generatePassword(generator.algorithm, generator.digits, generator.secret, counter), password, "Incorrect result for \(algorithm) at \(times[i])")
                    XCTAssertEqual(generatePassword(generator.algorithm, generator.digits, generator.secret, counter), password, "Inconsistent result for \(algorithm) at \(times[i])")
                }
            }
        }

        let secret = "12345678901234567890".dataUsingEncoding(NSASCIIStringEncoding)!
        let expectedValues = ["755224", "287082", "359152", "969429", "338314", "254676", "287922", "162583", "399871", "520489"]

        for (var counter = 0; counter < expectedValues.count; counter++) {
            XCTAssertEqual(generatePassword(.SHA1, 6, secret, UInt64(counter)), expectedValues[counter])
        }
    }

