public string GeneratePassword(string domainName, string masterPassword, int length, HmacGenerator hmacGenerator, CharacterSpace characterSpace) { IHmacGenerator generator = hmacGeneratorResolver.ResolverHmacGenerator(hmacGenerator); string space = characterSpaceGenerator.GenerateCharacterSpace(characterSpace); byte[] hmac = generator.GenerateHmacHash(domainName, masterPassword); string password = hmacToArbitraryEncodingConverter.ConvertToArbitraryEncodedString(hmac, space); string truncatedPassword = passwordTruncator.Truncate(password, length); return(truncatedPassword); }
public void TestResolveHmacSha1Generator(HmacGenerator hmacGenerator) { IHmacGenerator sha1HmacGenerator = hmacGeneratorResolver.ResolverHmacGenerator(hmacGenerator); Assert.AreEqual(sha1HmacGenerator.HmacGenerator, hmacGenerator); }