## 3 Materials and Methods
The second stage involves scanning users' images using an appropriate sensor included in the Arduino ESP 32 development board, extracting distinctive features, producing feature vectors as biometric templates, and storing them in a database. The decision to accept or reject depends on a comparison between the pictures stored in the  
Figure 1: Authentication mechanism architecture based on Raspberry and Arduino modules. database and the feature vector resulting from the processes of identification, authentication, and authorization. The user's facial database is centralized, stored, and encrypted externally on the Raspberry Pi 4 device and provides remote database management via a web-based console by an administrator or authorized individuals, which is one of the main advantages of this mechanism. The access to the web console is protected by a password established by authorized personnel to execute database management, to enhance the database's level of security. The liveness detection property embedded in the system is another important advantage that considerably improves the accuracy of the detection process and minimizes the possibilities of presentation attacks or replay attacks against this technology. The complexity of this system derives from using different types of homomorphic cryptographic algorithms including the FHE BFV and BGV algorithms, which are implemented and tested for encrypting the biometric database that contains the users' facial templates, to preserve data confidentiality, integrity, and availability. Among the various methods used for biometric encryption, homomorphic algorithms are considered to be strong and special types of asymmetric encryption, which use both a public key for encryption and a private key for decryption and allow performing different operations over the encrypted information without the need to decrypt it, while the information is in transit, storage, or computation [51]. The data owner has control over the entire information and decides who needs access to the original data, and when and how the template can be used, facts that represent a major advantage in reducing privacy risks and vulnerabilities and preventing the leakage of biometric information. In the current research, we chose to implement two homomorphic encryption algorithms and test them using several types of statistical parameters because it represents an innovative technology that brings a major change in the way confidential information is protected, processed, and shared, and fundamentally changes the course of the cryptographic process. Although significant differences and similarities between the BFV and the BGV algorithms have been highlighted in the literature, at a theoretical level, specifically for ciphertexts, we present an alternative approach for testing fully homomorphic encryption schemes at the implementation level in a real experimentation environment on facial biometric images. Figure 2: Web interface for users’ database administration. The BFV and BGV fully homomorphic encryption algorithms are structured on the hardness of the Ring Learning with Errors (RLWE) problem composed of polynomial rings, which allows several additive and multiplicative operations over the encrypted data without modifying the content of the resulting ciphertext. The resulting noise after performing the specific operations for each algorithm is considered a crucial aspect of these encryption schemes and expands simultaneously with the number of operations performed as specified by [52]. It increases exponentially during the encryption process and key generation to achieve the hardness properties, but extra noise accumulates substantially during the homomorphic multiplications. For noise management and encryption scheme optimization, bootstrapping, relinearization, and modulus-switching are specific procedures implemented to minimize the noise level and keep it under a certain limit for executing efficient and timely decryption.