Login Languish
Functions
password_utils.h File Reference

handles password verification tasks More...

#include <string>
#include <vector>
#include <algorithm>
Include dependency graph for password_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool password_utils::isPalindrome (std::string input)
 checks if a string is a palindrome More...
 
bool password_utils::isPrime (int n)
 checks if a number is prime More...
 
bool password_utils::hasPrime (std::string input)
 checks if a string contains a prime number More...
 
bool password_utils::hasColour (std::string input)
 checks if a string contains a colour More...
 

Detailed Description

handles password verification tasks

Author
Jack Searle

Function Documentation

◆ hasColour()

bool password_utils::hasColour ( std::string  input)

checks if a string contains a colour

iterates through list of colours and checks whether a lowercase copy of the input string contains the colour.

Parameters
inputthe string to be checked for colours
Returns
true if the string contains a colour, otherwise false

◆ hasPrime()

bool password_utils::hasPrime ( std::string  input)

checks if a string contains a prime number

checks through strings for entire numbers (15 will be read as 15, not 1 and 5) before checking if any of those numbers are prime.

Parameters
inputthe string to be checked for prime numbers
Returns
true if the string contains a prime number, otherwise false

◆ isPalindrome()

bool password_utils::isPalindrome ( std::string  input)

checks if a string is a palindrome

iterates through the first half of the string and checks it is being mirrored in the other half

Parameters
inputthe string to be checked
Returns
true if the string is a palindrome, otherwise false

◆ isPrime()

bool password_utils::isPrime ( int  n)

checks if a number is prime

checks base cases before iterating through all integers up to the square root of the number being checked.

Parameters
nthe integer to be checked
Returns
true if n is a prime number, otherwise false