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 string GenerateCharacterSpace(CharacterSpace characterSpace) { var stringBuilder = new StringBuilder(); foreach (ISingularCharacterSpaceGenerator generator in singularCharacterSpaceGenerators) { if (characterSpace.HasFlag(generator.SpaceIdentifier)) { stringBuilder.Append(generator.GenerateSingularCharacterSpace()); } } return(stringBuilder.ToString()); }
IEnumerator PerformDash(Vector2 dashVectorNormalized, float timeToDash, float resetTime, float dashLength, CharacterSpace space = CharacterSpace.Camera) { // If instant (make appear instant, avoid division by 0) if (timeToDash == 0) { timeToDash = 0.001f; } // cache position at the start of this dash Vector3 startPos = transform.position; // toDash is the target dash based on the dash length and our dash vector (NORMALIZED) Vector3 toDash = (new Vector3(dashVectorNormalized.x, 0, dashVectorNormalized.y) * dashLength); // The stepping amount of dash Vector3 lastSubDashPos = new Vector3(0, 0, 0); // Disallow a dash to begin m_canDash = false; // Reset for safety m_dashResetTimer = 0; // Perform dash for the full time while (m_dashResetTimer < (timeToDash + resetTime)) { if (m_dashResetTimer < timeToDash) { // Get the sub dash vector (timer based) Vector3 thisLerp = Vector3.Lerp(Vector3.zero, toDash, m_dashResetTimer / timeToDash); // Actually move the player MovementLibrary.MovePlayer(this, thisLerp - lastSubDashPos, space); // Set the last position to the current position lastSubDashPos = thisLerp; } m_dashResetTimer += Time.deltaTime; yield return(null); } // Allow for re-dashing m_canDash = true; // Drop out of dash (completed) yield return(null); }
// External/Internal dashing function, in a normalized (x,z) direction public void Dash(Vector2 movementRawR, float timeToDash, float resetTime, float dashLength, CharacterSpace space = CharacterSpace.Camera, bool overrideCurDash = false) { // Can I dash or am I forcing a new dash if (m_canDash || overrideCurDash) { // Hard reset the current dash if (overrideCurDash) { // We have a running coroutine if (m_dashCoRoutine != null) { // Make sure we're not instancing a new dash coroutine StopCoroutine(m_dashCoRoutine); } } // Otherwise we can assume that the player "can" dash and therefore the dash coroutine is not running, because // "m_canDash" should ONLY be set to true from inside the end case of the coroutine // Player is dashing, prepare m_dashResetTimer = 0; m_dashCoRoutine = PerformDash(new Vector3(movementRawR.x, movementRawR.y), timeToDash, resetTime, dashLength, space); StartCoroutine(m_dashCoRoutine); } }
public string TestGenerateCharacterSpace(CharacterSpace characterSpace) { return generator.GenerateCharacterSpace(characterSpace); }