# CNN-Based Multi-Factor Authentication System for Mobile Devices Using Faces and Passwords
## 3 Proposed System
### Secure Password Transformation (SPT) Algorithm  
SPT is an algorithm that transforms a text password into a secure password image. There are five steps, and the function of each is described as follows. 1. Convert the password text into a bit string: This step converts the password entered as text into a binary bit string. It is written as a bit string of a specified length, taking into account the number of pixels to be used in the image. In this experiment, it was configured as 2080 bits. 2. Convert the bit string into a black and white image: The password bit string is composed into a grayscale image, where 0 is black and 1 is white. In this experiment, the image size was set to 65 \(\times\) 65 = 4225 pixels, of which 2080 pixels were created as password bit strings and the remaining 2145 pixels were filled with random bit strings. The location of the 2080 password string pixels was fixed, and security was implemented by specifying a different location for each user. 3. Transform black-and-white pixels to color pixels: This transforms the grayscale image into a RGB color image. In this experiment, the password string's 2080 pixels were transformed into color pixels through multiplying by a specified value, while the remaining 2145 pixels were assigned random colors. 4. Blend the color pixels and pixels of a mask image: The password RGB color image created in (3) and a mask image designated for each user are blended. Pixel blending is achieved through applying the equation below. The mask image was designated separately for each user, in order to further enhance security. In the equation, the \(\alpha\) value was set as 0.5, the Image_mask was RGB pixel values of mask image, and Image_RGB_color was RGB pixel values of the password RGB-color image. \[\text{Image\_pw}=\alpha\times\text{Image\_mask}+(1-\alpha)\times\text{ Image\_RGB\_color} \tag{1}\]
5. Output the secure password image: The final secure password image that is created is saved. The step-by-step generated images are displayed in Figure 5.  
Figure 5: Steps involved in transforming a text password into a secure password image. The SPT algorithm inputs the password text and mask image and outputs a secure password image. Password image security can be explained from two perspectives. If the password text is converted into an image with a width of 65 pixels and a height of 65 pixels, it will have 65 \(\times\) 65 = 4225 pixels. If the password bit string length is fixed to 2080, the number of ways to find 2080 positions among 4225 pixels in a combination expression is 4225C200 >> 4225C200 >> 21024, which is safe. In addition, the mask image designated for each user has a size of 65 \(\times\) 65 pixels, and the password image is safe, as blending is performed while the mask image is hidden within the system rather than exposed to the outside. Algorithm 1 presents the SPT algorithm. ```
Input: Password Text pw_text, Mask Image image_mask Output: Secure Password Image secure_pw_image
01:# initialize variables
02: img_width = 65 # width, height
03: img_pixel = 4225 # 65 \(\times\) 65 = 4225
04: pw_length = 2080 # password length = 2080 bits
05: alpha = 0.5 # alpha value to be used for blending images
06:# (1) Make password text into bit string
07: password_bits = stringbotary(password_string, pw_length)
08:# (2) Make bit string into black and white
09:# Select password 2080 pixel location among 4225 pixels
10: pw_place = random_choice(img_pixel, size = pw_length, replace = False)
11:# password bits are stored in the 2080 positions out of 4225 bits. 12:# 0 or 1, random binary bits are stored in the remaining locations. 13: image_bits = random_choice(2, size= img_pixel, replace = True)
14:for i in range(0,imp_pixel) #4225
15:for j in range(0,pw_length): #2080
16:if i = img_w_place[j]: #2080
17: image_bits[i] = password_bits[j]
18: pw_array_before[i] = image_bits[i]
19:# Convert 4225 bit array into 65 \(\times\) 65 gray image.