Apply Multi-Biometrics Recognition Systems for Intelligent House Management



Similar documents
May For other information please contact:

Biometrics in Physical Access Control Issues, Status and Trends White Paper

Each ievo reader needs its own network cable, as each reader has its own IP address. Ensure this has been taken into consideration

22 nd NISS Conference

ARM7 Based Smart ATM Access & Security System Using Fingerprint Recognition & GSM Technology

Application-Specific Biometric Templates

Physical Security: A Biometric Approach Preeti, Rajni M.Tech (Network Security),BPSMV preetytushir@gmail.com, ratri451@gmail.com

Microcontroller Based Smart ATM Access & Security System Using Fingerprint Recognition & GSM Technology

Framework for Biometric Enabled Unified Core Banking

Accessing the bank account without card and password in ATM using biometric technology

Easy Data Centralization with Webster. User Guide

Assignment 1 Biometric authentication

Automated Regional Justice Information System (ARJIS) Acceptable Use Policy for Facial Recognition

Introducing... The Word's Most Advance. Biometric Time Attendance Door Access Security System

Using the enclosed installation diagram, drill three holes in the wall with the lower hole 1150mm from the floor.

DAZZLE INTEGRATED DATA BACKUP FEATURE.

solutions Biometrics integration

FrontDesk Installation And Configuration

ENHANCING ATM SECURITY USING FINGERPRINT AND GSM TECHNOLOGY

PROPOSED SOLUTION FOR BIOMETRIC FINGERPRINT TIME AND ATTENDANCE MANAGEMENT SYSTEM

YubiKey with Password Safe

Two Factor Authentication. Software Version (SV) 1.0

River Valley Credit Union Online Banking

HandPunch. Overview. Biometric Recognition. Installation. Is it safe?

INTEGRATED STAFF ATTENDANCE SYSTEM (ISAS) WEE PEK LING

Biometric Authentication Platform for a Safe, Secure, and Convenient Society

Digital Identity & Authentication Directions Biometric Applications Who is doing what? Academia, Industry, Government

BIOMETRIC SOLUTIONS 2013 ISSUE

User Guide. Chapter 6. Teacher Pages

Biometrics is the use of physiological and/or behavioral characteristics to recognize or verify the identity of individuals through automated means.

The Benefits of an Industry Standard Platform for Enterprise Sign-On

Access Control and Audit Trail Software

Flexible Identity. Tokenless authenticators guide. Multi-Factor Authentication. version 1.0

W.A.R.N. Passive Biometric ID Card Solution

Enterprise Remote Control 5.6 Manual

- BIOMETRIC. Tel : Website : marketing@litestar.com.sg

Development of Attendance Management System using Biometrics.

Biometrics: Advantages for Employee Attendance Verification. InfoTronics, Inc. Farmington Hills, MI

GLOBAL JOURNAL OF ENGINEERING SCIENCE AND RESEARCHES

OA101 Fingerprint Time attendance system Preface

The Nuts and Bolts of Autodesk Vault Replication Setup

This method looks at the patterns found on a fingertip. Patterns are made by the lines on the tip of the finger.

WHITE PAPER. Let s do BI (Biometric Identification)

Embedded Web Server. User Guide. General usage guide lines to the ISONAS Embedded Web Server available on all ISONAS PowerNet reader-controllers

Global Deployment of Finger Vein Authentication

Fingerprint Enrollment Procedures

PUBLIC Password Manager for SAP Single Sign-On Implementation Guide

CENTRALLY MANAGED. Access Control

SOFTWARE INSTALLATION INSTRUCTIONS CLIENT/SERVER EDITION AND WEB COMPONENT VERSION 10

Partizan Access Control Management User Manual. Version 2.0.0, 14 August 2015

How To Use 1Bay 1Bay From Awn.Net On A Pc Or Mac Or Ipad (For Pc Or Ipa) With A Network Box (For Mac) With An Ipad Or Ipod (For Ipad) With The

Trends in Finger Vein Authentication and Deployment in Europe

«Intellect» software system

addressed. Specifically, a multi-biometric cryptosystem based on the fuzzy commitment scheme, in which a crypto-biometric key is derived from

Smart Cards and Biometrics in Privacy-Sensitive Secure Personal Identification Systems

V2.0 Attendance System Hardware Suite Guide Instructions Manual

Digital Persona Fingerprint Reader Installation

Search help. More on Office.com: images templates

F-Secure Messaging Security Gateway. Deployment Guide

UniFinger Engine SDK Manual (sample) Version 3.0.0

SURPASS HOSTING SERVICE GETTING STARTED AND OPERATIONS GUIDE

ZKTime5.0 Attendance Management Software User Manual

Securing corporate assets with two factor authentication

EMC Physical Security Enabled by RSA SecurID Two-Factor Authentication with Verint Nextiva Review and Control Center Clients

Access Control Software Manual

Centran Version 4 Getting Started Guide KABA MAS. Table Of Contents

Upgrading from Call Center Reporting to Reporting for Call Center

A puzzle based authentication method with server monitoring

Online Backup and Recovery Manager Setup for Microsoft Windows.

Tips and Tricks SAGE ACCPAC INTELLIGENCE

Clickfree The Effortless Backup Solution

De-duplication The Complexity in the Unique ID context

Fingerprint Based Biometric Attendance System

DigitalPersona Pro Enterprise

Upgrading from Windows Vista to Windows 7

Migrating helpdesk to a new server

Report on the Train Ticketing System

3D PASSWORD. Snehal Kognule Dept. of Comp. Sc., Padmabhushan Vasantdada Patil Pratishthan s College of Engineering, Mumbai University, India

Business Intelligence Getting Started Guide

Using MS-SQL Server with Visual DataFlex March, 2009

MSSQL quick start guide

VeriSign PKI Client Government Edition v 1.5. VeriSign PKI Client Government. VeriSign PKI Client VeriSign, Inc. Government.

Installation & Maintenance Guide

GMS GRAPHICAL MANAGEMENT SYSTEM

Server Installation, Administration and Integration Guide

Published by Murphy & Company, Inc Barrett Office Dr Suite 206 St. Louis, MO

Expat Tracker. User Manual HR Systems Limited

Security+ Guide to Network Security Fundamentals, Fourth Edition. Chapter 10 Authentication and Account Management

Getting Started - The Control Panel

Automatic Biometric Student Attendance System: A Case Study Christian Service University College

SPICES BOARD (Ministry of Commerce & Industry, Govt. of India) Palarivattom.P.O. N H By Pass Kochi

Manage and secure your workplace by controlling who, what, when, why, where and how people are allowed in your facility. Marquee

SourceForge Enterprise Edition 4.4 SP1 User Guide

TrustKey Tool User Manual

Biometric SSO Authentication Using Java Enterprise System

VMWare Workstation 11 Installation MICROSOFT WINDOWS SERVER 2008 R2 STANDARD ENTERPRISE ED.

Voice Authentication for ATM Security

Sage Intelligence Financial Reporting for Sage ERP X3 Version 6.5 Installation Guide

Transcription:

Hong Kong Institute of Vocational Education (Tsing Yi) Department of Multimedia and Internet Technology Higher Diploma in Multimedia and lnternet Applications (41381) Final Year Project Report Apply Multi-Biometrics Recognition Systems for Intelligent House Management By Chan Ka Lun, Peae Tsang Man Piu Academic Year 2005/06 Supervised by Mr. MK Lam

ABSTRACT This final year project describes the design and development of applying the biometrics technology with facial recognition and fingerprint recognition system. Several commonly used applications for our biometric system are reviewed in this report. Details of the design criteria of both hardware and software principles of operation as well as the testing and verification of the system are presented. Further development of project is also proposed and recommended. This project is to develop and built up a biometrics system for intelligent house and clubhouse. As biometrics is a popular and safety technology, the project applies this technology to improve the security level and easy for management. i

TABLE OF CONTENTS page ABSTRACT TABLE OF CONTENTS LIST OF FIGURES LIST OF TABLES LIST OF APPENDICES i ii v viii ix Chapter 1 Introduction 1 1.1 Overview 1 1.2 Background Information 1 1.3 Structure of the Final Year Project Report 1 Chapter 2 Literature Review 3 2.1 Introduction 3 2.2 Introduction to Biometrics Technologies 3 2.2.1 What is Biometrics? 3 2.2.2 History of Biometrics 3 2.2.3 How does it work? 4 2.2.4 Applications in Biometrics 6 2.2.5 Template size of each Biometrics Technology 7 2.3 Examples of biometrics system in my life 7 2.4 Examples of biometrics system layout 8 2.5 Examples of hardware design 10 2.6 Examples of software interface design 11 2.7 Summary 12 Chapter 3 Development Methodology for Multi-Biometrics Recognition System 13 3.1 Introduction 13 3.2 Design Consideration of Hardware System 13 3.3 Design Consideration of Software 17 3.4 Graphics Design and Layout 17 3.5 Structure of Database Design 19 ii

Chapter 4 Details of the Multi-Biometrics Recognition System 20 4.1 Overview 20 4.2 Workflow of Recognition System 21 4.3 Function of Recognition System 22 4.3.1 Function of Administration tools 22 4.3.2 Function of Building security system 23 4.3.3 Function of Clubhouse system 23 4.4 Hardware of Recognition System 24 4.5 Development Software use 25 4.6 Software needs and setup 26 4.7 Database Structure 28 4.7.1 Relational between tables 28 4.7.2 Householder 29 4.7.3 Householder Log 29 4.7.4 Visitor 30 4.7.5 Building 30 4.7.6 Floor and Flat 31 4.7.7 Clubhouse 31 4.8 Graphics Design and Layout 32 4.8.1 Administration Tools layout design 32 4.8.2 Building security system layout design 34 4.8.3 Clubhouse system layout design 35 Chapter 5 Evaluation of Multi-Biometrics Recognition Systems 38 5.1 Overview 38 5.2 Principle of Biometric Enrolment and Verification 38 5.3 Summary 38 Chapter 6 Application Procedure of Multi-Biometrics Recognition Systems 39 6.1 Administration tools 39 6.1.1 Add new householder 39 6.1.2 Edit householder 43 6.1.3 Delete householder 45 6.1.4 Householder entry log 46 6.1.5 Visitor entry log 47 6.2 Building Security System 49 iii

6.2.1 Householder mode 49 6.2.2 Visitor mode 51 6.3 Clubhouse system 54 6.3.1 Clubhouse login and logout system 54 6.3.2 Clubhouse payroll system 57 Chapter 7 Verification of the Multi-Biometrics Recognition Systems 59 7.1 Overview 59 7.2 Verification of Result 59 7.3 Summary 59 Chapter 8 Conclusion and Further Development 60 8.1 Overview 60 8.2 Contribution of Final Year Project 60 8.3 Discussion on the Project Limitation 60 8.4 Further Proposal 61 References 62 Appendices 64 Appendix A: Team member workload 64 Appendix B: Project plan 65 Appendix C: Programming code 66 iv

LIST OF FIGURES page Fig. 2.1 Biometric identification and encrypted data system 8 Fig. 2.2 Biometric access control system (Exys Security system) 8 Fig. 2.3 Country entry and exit control system 8 Fig. 2.4 Hand geometry control system 9 Fig. 2.5 Biometric experiment system 9 Fig. 2.6 Presse Fotos ekey fingerprint system 10 Fig. 2.7 Biometric reader clocking system 10 Fig. 2.8 Office access control system 10 Fig. 2.9 Windows lcqon recognition system 11 Fig. 2.10 Breaker facial searching system 11 Fig. 2.11 Biometric Patient Tracking System 11 Fig. 2.12 fingerid system with biometrics in USA 11 Fig. 3.1 Types of fingerprint 13 Fig. 3.2 Optical Fingerprint Sensors 14 Fig. 3.3 Surface Pressure Sensor 14 Fig. 3.4 Capacitive Sensors 14 Fig. 3.5 Facial geometry example 15 Fig. 3.6 Correct recognition example 15 Fig. 3.7 Facial recognition in airport 16 Fig. 3.8 First Visitor mode layout 17 Fig. 3.9 Second Visitor mode layout 18 Fig. 3.10 Clubhouse mode layout 18 Fig. 3.11 Database schema of Biometrics System 19 Fig. 4.1 Structure of System 20 Fig. 4.2 Workflow of Building security system 21 Fig. 4.3 Workflow of Clubhouse system 22 Fig. 4.4 Marcomedia Flash 25 Fig. 4.5 Adobe Photoshop 25 Fig. 4.6 Visual Basic 6.0 25 Fig. 4.7 Create MySQL user 26 Fig. 4.8 Restore the backup file 27 Fig. 4.9 Permission of the folder 27 Fig. 4.10 Folder of householder and visitor 28 Fig. 4.11 Database Structure of Systems 28 v

Fig. 4.12 Main page of Administration Tools 32 Fig. 4.13 Database Management of Householder 32 Fig. 4.14 Entry Log of Householder 33 Fig. 4.15 Entry Log of Visitor 33 Fig. 4.16 Selection mode of building security system 34 Fig. 4.17 Householder mode of building security system 34 Fig. 4.18 Visitor mode of building security system 35 Fig. 4.19 Language Selection mode of clubhouse system 35 Fig. 4.20 Selection mode of clubhouse system 36 Fig. 4.21 Login mode of clubhouse system 36 Fig. 4.22 Choose facilities mode of clubhouse system 37 Fig. 4.23 Logout mode of clubhouse system 37 Fig. 6.1 Select Database Management 39 Fig. 6.2 Click the Add New button 39 Fig. 6.3 Add user windows 40 Fig. 6.4 Procedure of face enrollment 40 Fig. 6.5 Successful message of face enrollment 41 Fig. 6.6 Successful message of add new householder 41 Fig. 6.7 Error message of add new householder 42 Fig. 6.8 New householder in the list 42 Fig. 6.9 Click the Edit button 43 Fig. 6.10 Enroll new face 43 Fig. 6.11 Successful message of face enrollment 44 Fig. 6.12 Successful message of update householder 44 Fig. 6.13 Delete the householder 45 Fig. 6.14 Confirm to delete householder 45 Fig. 6.15 Select Entry Log of householder 46 Fig. 6.16 Query of Householder Entry Log 46 Fig. 6.17 Result of Householder Entry Log 47 Fig. 6.18 Select Entry Log of visitor 47 Fig. 6.19 Query of Visitor Entry Log 48 Fig. 6.20 Show the photo of visitor 48 Fig. 6.21 Mode selection of Building Security System 49 Fig. 6.22 Procedure of identify the householder 49 Fig. 6.23 Error message when cannot identify the householder 50 Fig. 6.24 Householder identify complete 50 Fig. 6.25 Mode selection of Building Security System 51 Fig. 6.26 Procedure of enter the floor and flat 51 vi

Fig. 6.27 Error message of enter wrong floor 52 Fig. 6.28 Procedure of face capture 52 Fig. 6.29 Procedure of fingerprint capture 53 Fig. 6.30 Visitor register complete 53 Fig. 6.31 Step 1 of process clubhouse system 54 Fig. 6.32 Step 2 of process clubhouse system 54 Fig. 6.33 Step 3 of process clubhouse system 55 Fig. 6.34 Step 4 of process clubhouse system 55 Fig. 6.35 Step 5 of process clubhouse system 56 Fig. 6.36 Step 6 of process clubhouse system 56 Fig. 6.37 Step 1 of process clubhouse payroll system 57 Fig. 6.38 Step 2 of process of clubhouse payroll system 57 Fig. 6.39 Step 3 of process of clubhouse payroll system 58 vii

LIST OF TABLES page Table 2.1 Template size of each Biometrics Technology 7 Table 4.1 Database structure of householder 29 Table 4.2 Database structure of householder log 29 Table 4.3 Database structure of visitor 30 Table 4.4 Database structure of building 30 Table 4.5 Database structure of floor and flat 31 Table 4.6 Database structure of clubhouse 31 Table 7.1 FRR rate of facial recognition 59 Table 7.2 FAR rate of facial recognition 59 viii

LIST OF APPENDICES page Appendix A Team member workload 64 Appendix B Project plan 65 Appendix C Programming code 66 ix

Chapter 1 Introduction 1.1 Overview Nowadays, Biometrics becomes important in our life. Since it has a high security and convenient, so that people use Biometrics technology on anything. Such as, door access control, border control, banking, identify people, intelligent house, etc. The application is very diverse and their capacity of development is very large. The intelligent house becomes popular for the past few years. It can provide a safety and comfortable to the householder. But the security is very important, it must be identify the house holder accurately and prevent the system to make a mistake for identification. So that, we need to build a system like the security to make a identity and monitoring the security of building. 1.2 Background Information In fact, Hong Kong building security is decreased. The thief is increased to make the people safety to be damaged. So, we must improve the building security and the management. By the way, when we come back to our building, we may use words of password or the key to open the building door. That is so trouble and inconvenience. Biometrics technologies can help us to improve the security and easy to management. So, we may use the biometrics technologies to maintain our final year project. 1.3 Structure of the Final Year Project Report The remainder of this report is divided into Seven Chapters. They are as follows: - Chapter 2 covers the literature review on the design research of biometrics system. We find a lot of the information and image from Internet. Chapter 3 discusses on the design criteria of hardware system, software, layout and database Chapter 4 presents the details of the components of the hardware software, workflow and database about our system. Chapter 5 describes the performance evaluation of the developed system about the principle of biometric enrolment and verification. Chapter 6 and 7 describe the enrolment and verification procedure of how to capture and record of our recognition system. 1

Chapter 8 concludes the report and out lines the contributions of the project. The limitations were highlighted and suggestions are made for further development to improve the system. 2

Chapter 2 Literature Review 2.1 Introduction That part is literature review. It means we will show you all our research before our project starting. And the research should be about example of biometric system, layout of the hardware system, layout of the software interface, etc. We will show you all of our research for the final year project. 2.2 Introduction to Biometrics Technologies 2.2.1 What is Biometrics? The term biometrics refers to the emerging field of technology devoted to the identification of individuals using biological traits or behaviours [1]. In practice, this means capturing an image of a unique feature of an individual such as a fingerprint, hand, eye or face, and comparing it with a template captured previously. For ease of explanation this has been over-simplified, but in essence this is biometric technology works. Human Recognition Systems works with 4 key biometric technologies: Iris Recognition Hand Recognition Fingerprint Recognition Facial Recognition 2.2.2 History of Biometrics 1800s identification largely relied upon "photographic memory" [2]. This was changed in 1883 when Alphonse Bertillon, a clerk in the Paris police prefecture, introduced physical measurement system (which came to bear his name: bertillonage) Bertillon based his system on the claim that measurement of adult bones does not change throughout life. Measurements in his system included: height, length, and breadth of the head, the length of different fingers, the length of forearms, etc (Bertillon estimated that the odds of duplicate records were 286,435,456 to 1 if 14 traits were used. After this, the police used finger printing, which was developed by Richard Edward Henry of Scotland Yard, instead. Essentially reverting to the same methods used by 3

the Chinese for years. However the idea of biometrics as a field of study with useful identification applications, was there and interest in it has grown. Personal Identification Numbers (PINs) were one of the first methods used for identification. There are also methods that involve passwords and physical tokens e.g. smart cards. There are a number of problems associated with this kind of identification. People forget passwords, lose tokens, reuse passwords, write them down, tokens can get stolen. The recognition of the above does not mean the identification of the person providing it - they could be presented by anybody. With the advent of e-commerce brings increased pressure on IT managers to provide partners and customers with means of identification to access corporate networks. This results in a deluge of passwords and means of access, which are often forgotten, misused or lost. With the increased population accessing these networks the risk of attacks on the networks is increased. Companies are turning to Biometric Systems to bring tighter security to their computer networks. Today we have the technology to realize the aims, and to refine the accuracy of biometric identification, and therefore the possibility of making it a viable field. Soon biogenetics technology will be used in every house hold and it is getting increasingly more and safer to use biometric technologies in order to better our life. 2.2.3 How does it work? False Reject Rates: For most applications, letting the good guys in is just as important as keeping the bad guys out [3]. The probability that a biometric device won't recognize a good guy is called the "False Reject Rate." The False Reject Rates quoted for current biometric systems range from 0.00066% to 1.0%. A low False Reject Rate is very important for most applications, since users will become extremely frustrated if they're denied access by a device that has previously recognized them. 4

There has a example may be helpful. A company with 100 employees has a biometric device at its front door. Each employee uses the door four times a day, yielding 400 transactions per day. A False Reject Rate of 1.0% predicts that every day, four good guys (1% of 400) will be denied access. Over a five-day week, that means 20 problems. Reducing the False Reject Rate to 0.1% results in just two problems per week. A low False Reject Rate is very important for most applications, since users will become extremely frustrated if they're denied access by a device that has previously recognized them. As mentioned previously, the combination of a low False Reject Rate plus a simple keypad code provides virtually unbreakable security. Equal Error Rates: Error curves give a graphical representation of a biometric device's "personality." The point where false accept and false reject curves cross is called the "Equal Error Rate." The Equal Error Rate provides a good indicator of the unit's performance. The smaller the Equal Error Rate, the better. Validity of Test Data: Testing biometrics is difficult, because of the extremely low error rates involved. To attain any confidence in the statistical results, thousands of transactions must be examined. Some error rates cited by manufacturers are based on theoretical calculations. Other rates are obtained from actual field testing. Field data are usually more reliable. In the case of False Reject rates, only field test data can be considered accurate, since biometric devices require human interaction. For example, if the device is hard to use, false reject rates will tend to rise. A change in the user's biometric profile could also cause a false reject (a finger is missing, for example). None of these conditions can be accurately quantified by purely theoretical calculations. On the other hand, False Accept Rates can be calculated with reasonable accuracy from cross-comparison of templates in large template databases. 5

Currently, most field test error rates have been generated by various biometric manufacturers using end-user data. Tests have also been conducted by independent laboratories such as the U.S. Department of Energy's Sandia National Laboratories. The most recent test released by Sandia was performed in 1991. It's important to remember that error rates are statistical: they are derived from a series of transactions by a population of users. In general, the larger the population and the greater the number of transactions, the greater the confidence level in the accuracy of the results. If the error rate is reported at 1:100,000, and only 100 transactions were included in the study, the confidence level in the results should be very low. If the same error rate was reported for 1 million transactions, the confidence level would be much higher. The magnitude of the reported results affects the size of the sample required for a reasonable confidence level. If the reported error rate is 1:10, then a sample of 100 transactions may provide a sufficient confidence level. Conversely, a 100-transaction sample would be too small if the error rate was reported as 1:100,000. 2.2.4 Applications in Biometrics There are 9 biometrics applications: [4] Physical Access Control Logical Access Control Justice/Law Enforcement Time and Attendance Border Control/Airports HIPAA Financial/Transactional Integrators/Resellers Safes, Door Locks 6

2.2.5 Template size of each Biometrics Technology Biometrics Technology Iris Fingerprint Facial Hand Geometry Template size per record 256 Bytes 512-1000 Bytes >512 Bytes 9 Bytes Table 2.1 Template size of each Biometrics Technology 2.3 Examples of biometrics system in my life Law Enforcement The law enforcement community is perhaps the largest biometrics user group. Police forces thought the world use AFIS technology to process criminal suspect, match finger images and bring guilty criminals to justices. A number of biometrics vendors are earning significant revenues in this area. Banking Bank has been evaluating a range of biometrics technologies for many years. Automated Teller Machines (ATMs) and transaction at the point of scale are particularly vulnerable to fraud and can be secured by biometrics. Other emerging markets such as telephone banking and internet bank must also be totally secure for bankers alike. 7

2.4 Examples of biometrics system layout We researched that the following figures are the examples of the biometrics system. Fig. 2.1 Biometric identification and encrypted data system [5] Fig. 2.2 Biometric access control system (Exys Security system) [6] Fig. 2.3 Country entry and exit control system [7] 8

Fig. 2.4 Hand geometry control system [8] Fig. 2.5 Biometric experiment system [9] 9

2.5 Examples of hardware design We may show you our research of hardware. The following figures are below. Fig. 2.6 Presse Fotos ekey fingerprint system [10] Fig. 2.7 Biometric reader clocking system [11] Fig. 2.8 Office access control system [12] 10

2.6 Examples of software interface design The following figures are our research of the biometrics software interface examples. Fig. 2.9 Windows lcqon recognition system [13] Fig. 2.10 Breaker facial searching system [14] Fig. 2.11 Biometric Patient Tracking System [15] Fig. 2.12 fingerid system with biometrics in USA [16] 11

2.7 Summary After the research that, we find many about the information of biometrics and many different kinds of the biometrics system. In fact, there were many technologies were used the biometrics technology. It is the truth and it must be more popular in the future. Now a day, many old systems are displaced by the biometric system. For example: access control system, payroll system, banking system, etc. During the project development, the biometric hardware is used. There are TiFace system, U are U fingerprint system. TiFace system enables to capture and enrol user s face. U are U fingerprint system is use to capture and enrol user s fingerprint. So, we have to use the biometric in the future life. 12

Chapter 3 Development Methodology for Multi-Biometrics Recognition System 3.1 Introduction In this part, we will tell you about our first development methodology. What kinds of hardware did we use. Why we use that hardware. What kinds of software did we use. Why we use that software. And we also post our first layout design in that part. We will all tell you the answer 3.2 Design Consideration of Hardware System Fingerprint recognition represents the oldest method of biometric identification. Its history is going back as far as at least 2200 BC. The use of fingerprints as a personal code has a long tradition and was already used by the Assyrians, the Babylonians, the Chinese and the Japanese. Since 1897, dactyloscopy (synonym for non-computer-based fingerprint identification) has been used for criminal identification. A fingerprint consists of ridges (lines across fingerprints) and valleys (spaces between ridges). The pattern of the ridges and valleys is unique for each individual. [17] There are two major methods of fingerprint matching: Minutiae matching and global pattern matching. The first approach analyses ridge bifurcations and endings, the second method represents a more macroscopic approach. The last approach considers the flow of ridges in terms of, for example, arches, loops and whorls. As the equal-error-rate is low, therefore fingerprint recognition is very accurate. The prices of such systems compared to other biometric systems are quite low and the user acceptance is very high. The strength of fingerprint identification is, that it can be deployed in a varied range of environments. Fig. 3.1 Types of fingerprint [18] 13

There are 6 types of sensors for fingerprint recognition: Optical Fingerprint Sensors Themalelectric Sensors Capacitive Sensors E-Field Sensors Touchless Sensors Surface Pressure Sensor Fig. 3.2 Optical Fingerprint Sensors [19] Fig. 3.3 Surface Pressure Sensor [20] Fig. 3.4 Capacitive Sensors [21] The template size varies from 100 bytes to 1500 Bytes depending on the algorithm and the quality of a fingerprint. Nevertheless, very rarely there are fingerprints without any minutiae-points that leads to a failure to enroll (FER = Failure to Enroll Rate). It is also difficult to extract the minutiae points accurately when the fingerprint has got a low quality. 14

Introduction of facial recognition Facial recognition systems are built on computer programs that analyze images of human faces for the purpose of identifying them. The programs take a facial image, measure characteristics such as the distance between the eyes, the length of the nose, and the angle of the jaw, and create a unique file called a "template." Using templates, the software then compares that image with another image and produces a score that measures how similar the images are to each other. Typical sources of images for use in facial recognition include video camera signals and pre-existing photos such as those in driver's license databases. [22] Computers can do increasingly amazing things, but they are not magic. If human beings often can't identify the subject of a photograph, why should computers be able to do it any more reliably? The human brain is highly adapted for recognizing faces - infants, for example, remember faces better than other patterns, and prefer to look at them over other patterns. The human brain is also far better than computers at compensating for changes in lighting and angle. The fact is that faces are highly complex patterns that often differ in only subtle ways, and that it can be impossible for man or machine to match images when there are differences in lighting, camera, or camera angle, let alone changes in the appearance of the face itself. Fig. 3.5 Facial geometry example [23] Fig. 3.6 Correct recognition example [24] 15

All of this makes face recognition ideal for high traffic areas open to the general public, such as: Airports and railway stations Casinos Cashpoints Stadiums Public transportation Financial institutions Government offices Businesses of all kinds Fig. 3.7 Facial recognition in airport [25] 16

3.3 Design Consideration of Software We choose macromedia flash and adobe Photoshop for our design software. Why we use that two software for design development? It is because macromedia flash is so powerful. It can be used actionscript for many different of animation. Although, it is easy to use and popular in the design area. The second point is we don t want to have a static and boring interface. So, we decided to use flash animation to replace of static picture interface. It can attract the people to use our system and make the system more interest. In the internet, many people used that two software. It is the brand name power and that software is really good for design. On the other hand, Photoshop can help us for tuning the photo color, light, size, effect, etc. It also can help us to make the picture be good. 3.4 Graphics Design and Layout Fig. 3.8 First Visitor mode layout 17

Fig. 3.9 Second Visitor mode layout. Fig. 3.10 Clubhouse mode layout 18

3.5 Structure of Database Design The following Fig. 3.11 is our first development of database structure design. It only consists of 4 tables: tblhouseholder, tblbuilding, tblvisitoryymmdd and tblfloorflat. That is our first developed schema. Fig. 3.11 Database schema of Biometrics System 19

Chapter 4 Details of the Multi-Biometrics Recognition System 4.1 Overview In this part, we finished to discuss and develop all the kinds of tool should we use. We will use two hardware for the system. It should be Face recognition and fingerprint hardware. And we will tell you the function of our biometric system. It has three different parts of the recognition system, please refer to Fig. 4.1. Finally, we choose the software, hardware and the final layout. We will show you all the things in the following. Fig. 4.1 Structure of System 20

4.2 Workflow of Recognition System The following two figures 4.2 & 4.3 are our workflow of the building security system and clubhouse system. Entry Select Mode Visitor Input Floor and Flat Householder Facial Recognition Enroll Face Invaild Check database & identify Enroll Fingerprint Vaild Open door Open door Fig. 4.2 Workflow of Building security system 21

Entry Select Login/Logout Logout Login Login mode Logout mode Facial recognize Facial recognize Invaild vaild Invaild vaild Check database Check database Store login time to database Store logout time to database Fig. 4.3 Workflow of Clubhouse system 4.3 Function of Recognition System There are three parts of our recognition system. It consists of Administration Tools, Building security system and Clubhouse system. 4.3.1 Function of Administration Tools Actually, householder and visitor also need to enroll fast when they want to use the biometric system. We make an enrolment to analysis this problem. Householder can come to our office to use the householder enrolment system. They only need to put their face in front of the camera. Their face record will store to our database for verify used. They also need to type their information (e.g. name, 22

gender, and floor no., flat no., etc.) to our database used. It is used for comparison. 4.3.2 Function of Building security system We design that householder mode is for householder using. They are no need to remember the word of password for house entry. It is because the entry password always changed a time. The householder may forget the password or remember the wrong one. So, Householder mode system can help person easily for entry. They only put their face in front of camera. If they are our householders then the door will open automatically by our system. Nowadays, people visit to their friend house. They must write down their personal information (e.g. name, id, gender, visit reason, visit room no.) in the building entry control. It is because the building needs to protect their householder safety and giving record. It may make the visitor inconvenient. So, we make a visitor mode for visitor using. It can help visitor more convenient, Visitor only put their face in front of camera and fingerprint to record their personal data. That should be fast and more convenient than the paper record. 4.3.3 Function of Clubhouse system Clubhouse is to be more popular to the new building. Householders can use their own clubhouse facilities. When they used the clubhouse facilities, they need to make a paper rent. That is not convenient and trouble. So, we make a clubhouse biometric system for householder using. They only open our system and put their face in front of the camera. Our system will record their login time. Otherwise, when they want to logout and leave that they also use our system to record their logout time. They can use our clubhouse easily. When you finished your playing from clubhouse, you need to pay the free to the clubhouse using. We make a payroll system for clubhouse payment. Householder only put their face in front of camera. Our database will search your clubhouse login time and logout time used for calculate the price. When you know the price that you only pay the money to our staff. He will help you to finish the payment process. 23

4.4 Hardware of Recognition System We choose facial recognition and fingerprint for our system used Facial recognition systems are computer-based security systems that are able to automatically detect and identify human faces. These systems depend on a recognition algorithm. The first step for a facial recognition system is to recognize a human face and extract it fro the rest of the scene. Next, the system measures nodal points on the face, such as the distance between the eyes, the shape of the cheekbones and other distinguishable features. Facial recognition is a good biometric system and it is too convenience and user-friendly. So that, we use facial recognition for our system used. For the fingerprint reason, we found that following good points: More securable than passwords by intercepting use and approach of Unauthorized people whose identification is not registered. Free from inconvenience to upgrade and remember passwords and the company It can save much cost to manage passwords. Fast and exact perception with high technology of finger print identification. Adopted dsp system that is to calculate moving direction and distance without Password by the image perceiving sensor. No roller and soft movement thanks to less rubbing resistance. Finally, fingerprint is easy too use, user-friendly and too cheap in the kinds of biometrics devices. 24

4.5 Development Software use Macromedia Flash Fig. 4.4 Marcomedia Flash [26] Adobe Photoshop Fig. 4.5 Adobe Photoshop [27] These two design tools are very powerful and easy to use. It can help us to analysis all the design problems. And we can make many different effects by that two software. It is very popular and great. So that, we used the tools for our interface layout design. Programming tools Fig. 4.6 Visual Basic 6.0 [28] Visual Basic 6.0. It is very easy to learn. It seen that very simple and comfortable for user programming. Finally, it also is a popular programming tool in the common program company. 25

4.6 Software needs and setup The basic software needs to install of the system are below: Flash Player 8.0 TiFace Runtime TiFace SmartGate SDK Futronic Fingerprint SDK The server and driver of the system needs are below: MySQL Server 4.0.x MySQL ODBC 3.51 Driver For easy to manage the database, we suggest to install these software are below: MySQL Administrator MySQL Query Browser Now, I will show you how to create new database account and restore the table in database form sql backup file. Step1. Use MySQL Administrator to create a new account. The MySQL user and password also is ive. Then, click Apply changes. The user will be created. Fig. 4.7 Create MySQL user 26

Step2. Open the sql backup file to restore the table needs in the database. It will create the schema ive_fyp automatically. Fig. 4.8 Restore the backup file Next, I will show how to share the folder. This folder is used to store householder and visitor s template and photo. Step1. Create a folder userdata in your any local drive. E.g.: C drive. Step2. Share this folder and set the permission of Everyone to Full control. Fig. 4.9 Permission of the folder 27

Step3. Create two folders householder and visitor in the userdata folder. Fig. 4.10 Folder of householder and visitor Then, I will show you how to change the server ip of the system connect. Step1. Open the config.ini file in the same level of folder. Step2. Modify the IP and enter the correct server IP. For example, you MySQL server s IP is 192.168.0.1. So, you should enter the serverip=192.168.0.1. And the template file and photo also store in this server. Important: If your MySQL server is setup on localhost, you must enter 127.0.0.1. 4.7 Database structure 4.7.1 Relational between tables Fig. 4.11 Database Structure of Systems 28

4.7.2 Householder Table: fyp_tblhouseholder Description: Store the detail of householder Key Field Name Data Type Description intholderid INT(5) HouseHolder s ID chrholdername VARCHAR(255) HouseHolder s Name chrgender CHAR(1) HouseHolder s Gender datbirth DATE HouseHolder Birthday chrhkid VARCHAR(11) HouseHolder s HKID Number datregdate DATE Register Date chruserdata VARCHAR(64) Template Filename of Face Enroll intbuildingid INT(2) Building ID intffid INT(3) Floor and Flat ID Table 4.1 Database structure of householder 4.7.3 Householder Log Table: fyp_tblholderlog Description: Store the log of householder login Key Field Name Data Type Description intlogid INT(8) Log ID intholderid INT(5) Householder s ID datintime DATETIME Login Date and Time Table 4.2 Database structure of householder log 29

4.7.4 Visitor Table: fyp_tblvisitor Description: Store the detail and log of visitor Key Field Name Data Type Description intvisitorid INT(8) Visitor s ID chrfacedata VARCHAR(64) Template Filename of Face Enroll chrfingerdata VARCHAR(64) Template Filename of Fingerprint Enroll datentry DATETIME Entry Date and Time intbuildingid INT(2) Building ID of Visitor visit intffid INT(3) Floor and Flat ID of Visitor visit Table 4.3 Database structure of visitor 4.7.5 Building Table: fyp_tblbuilding Description: Store the name of building Key Field Name Data Type Description intbuildingid INT(2) Building ID chrbuildingname VARCHAR(255) Building Name Table 4.4 Database structure of building 30

4.7.6 Floor and Flat Table: fyp_tblfloorflat Description: Store the floor and flat Key Field Name Data Type Description intffid INT(3) Floor and Flat ID chrfloor CHAR(2) Floor Number chrflat CHAR(1) Flat Character Table 4.5 Database structure of floor and flat 4.7.7 Clubhouse Table: fyp_tblclublog Description: Store the log of householder using clubhouse Key Field Name Data Type Description intlogid INT Log ID intholderid INT(5) Householder s ID datintime DATETIME Login Date and Time datouttime DATETIME Logout Date and Time intprice INT(5) Price of using clubhouse Table 4.6 Database structure of clubhouse 31

4.8 Graphics Design and Layout 4.8.1 Administration Tools layout design Fig. 4.12 Main page of Administration Tools 1. Menu bar Fig. 4.13 Database Management of Householder 1. Query search 2. List of the householder 3. Add new householder 4. Edit selected householder 5. Delete selected householder 6. Refresh the List of householder 32

Fig. 4.14 Entry Log of Householder 1. List of entry log 2. Query search Fig. 4.15 Entry Log of Visitor 1. List of Entry Log 2. Query search 3. Photo of the visitor 33

4.8.2 Building security system layout design Fig. 4.16 Selection mode of building security system 1. Date and Time 2. Mode selection button Fig. 4.17 Householder mode of building security system 1. Date and Time 2. Camera box 3. Message box 4. Exit button 34

Fig. 4.18 Visitor mode of building security system 1. Date and Time 2. Display of floor and flat 3. Message box 4. Number and character keypad 5. Exit button 4.8.3 Clubhouse system layout Fig. 4.19 Language Selection mode of clubhouse system 1. Mode selection button 35

Fig. 4.20 Selection mode of clubhouse system 1. Mode selection button Fig. 4.21 Login mode of clubhouse system 1. Camera box 2. Message box 3. Login button 36

Fig. 4.22 Choose facilities mode of clubhouse system 1. Camera box 2. Message box 3. Login button 4. Facilities button Fig. 4.23 Logout mode of clubhouse system 1. Camera box 2. Message box 3. Logout button 37

Chapter 5 Evaluation of Multi-Biometrics Recognition Systems 5.1 Overview We would like to tell you our biometric system. It s all of good points in the popular area. And we also have any short points for future improvement. 5.2 Principle of Biometric Enrolment and Verification For the good side, people no need to remember the word of password for entry to their building. They no need to use any key or find other people to help them open the door. Our biometric system can easy to help people only put their face in front of the camera for open the door. It seen that it is very convenience, comfortable and user-friendly to our customer. For the bad side, when a householder sometime wears glasses, sometime not wear glasses. Our facial recognition system may verify failed for their glasses or cap. It is because our system is followed the capture face data to compare the person s face. If the person wear glasses or cap, it may verify failed. On the other hand, if the area has not enough light. It also may distort the verify %. It is because if the area has not enough light, then the camera can not capture the face data fully and immediately. 5.3 Summary In fact, all of the technology also has good and bad points. Facial recognition system also has that two points. But Biometric system really can help people to make the world convenience and more easy. So that, biometric system also can help human to analysis many problems. We may improve the biometric technology as soon as possible. It is because it may be the future one of the main technology. 38

Chapter 6 Application Procedure of Multi-Biometrics Recognition Systems 6.1 Administration Tools 6.1.1 Add new householder Step1. Select Householder -> Database Management in menu bar. Fig. 6.1 Select Database Management Step2. Click the Add New button. Fig. 6.2 Click the Add New button 39

Step3. The Add user windows will appear. Enter the detail of householder. Fig. 6.3 Add user windows Step4. Click the Start button to open the camera and click Enroll button to make a face enrollment. Fig. 6.4 Procedure of face enrollment 40

Step5. The successful message will be appear when the face enrollment success. Fig. 6.5 Successful message of face enrollment Step6. Click the Save button after enroll the face and enter the detail. The tools will add new householder in database and show the successful message. Fig. 6.6 Successful message of add new householder 41

Step7. If you do not enroll the face before click the Save button, the tools will show the error message and tell you enroll the face. Fig. 6.7 Error message of add new householder Step8. The tools will show you the new householder in the list. Fig. 6.8 New householder in the list 42

6.1.2 Edit householder Step1. Select the householder you want to edit in the list, and then click Edit button. Fig. 6.9 Click the Edit button Step2. Click the Start button to open the camera and click Enroll button to make a new face enrollment. Fig. 6.10 Enroll new face 43

Step3. The successful message will be appear when the face enrollment success. Fig. 6.11 Successful message of face enrollment Step4. Click the Save button after enroll the face and modify the detail. The tools will update householder in database and show the successful message. Fig. 6.12 Successful message of update householder 44

6.1.3 Delete householder Step1. Select the householder in the list and click Delete button. Fig. 6.13 Delete the householder Step2. The tools will ask you confirm to delete. Fig. 6.14 Confirm to delete householder 45

6.1.4 Householder entry log Step1. Select Householder -> Entry Log in menu bar. Fig. 6.15 Select Entry Log of householder Step2. Enter the householder ID or name and select the range of date to search the log. Fig. 6.16 Query of Householder Entry Log 46

Step3. The tools will show the result. Fig. 6.17 Result of Householder Entry Log 6.1.5 Visitor entry log Step1. Select Visitor -> Entry Log in menu bar. Fig. 6.18 Select Entry Log of visitor 47

Step2. Select the date and building Fig. 6.19 Query of Visitor Entry Log Step3. You can select the visitor in the list and it will show the photo of visitor. Fig. 6.20 Show the photo of visitor 48

6.2 Building Security System 6.2.1 Householder Mode Step1. Press the Householder button. Fig. 6.21 Mode selection of Building Security System Step2. The systems will identify after 3 seconds automatically. No needs enter any button. Fig. 6.22 Procedure of identify the householder 49

Step3. If the systems cannot identify you, it will show the error message and identify after 3 seconds again. Fig. 6.23 Error message when cannot identify the householder Step4. If success to identify, the systems will show your name and show you the success message. The door will be open. Fig. 6.24 Householder identify complete 50

6.2.2 Visitor Mode Step1. Press the Visitor button. Fig. 6.25 Mode selection of Building Security System Step2. Enter the floor and flat you want to go. Then, press the Enter button. Also, you can the Clear button when you enter wrong floor and flat. Fig. 6.26 Procedure of enter the floor and flat 51

Step3. Our floor range is 1 to 15. If you enter large than 15, you will get the error message and enter the correct floor. Fig. 6.27 Error message of enter wrong floor Step4. Press the button to capture your face when you are ready in front of the camera. After press the button, the systems will countdown 3 seconds to capture automatically. Fig. 6.28 Procedure of face capture 52

Step5. Put your any finger on the fingerprint device to capture your finger. It needs to capture 3 times. Fig. 6.29 Procedure of fingerprint capture Step6. After face and fingerprint capture, the systems will save your data in database and open the door. Fig. 6.30 Visitor register complete 53

6.3 Clubhouse system 6.3.1 Process of clubhouse login and logout system Step1. You can see the selection page. When you want to login clubhouse, you can press the 登 入 button Fig. 6.31 Step 1 of process clubhouse system Step2. The login page is opened. You can see the monitor and message. In this moment, you need to put your face in front of the camera. Fig. 6.32 Step 2 of process clubhouse system 54

Step3. When you are our householder, our database will find your face data. The system will let you pass the login process and click the login button for verifies. Fig. 6.33 Step 3 of process clubhouse system Step4. When you login successful, our database should store your login time record. Fig. 6.34 Step 4 of process clubhouse system 55

Step5. When you want to leave our clubhouse, you must logout our system. It is as same as login part. You also put on your face in front of the camera. Our database will record your logout time automatically. Fig. 6.35 Step 5 of process clubhouse system Step6. When you logout successful, our database should store your logout time record. Fig. 6.36 Step 6 of process clubhouse system 56

6.3.2 Process of clubhouse payroll system Step1. When you pay the clubhouse free, you may go to our clubhouse payroll system. Fig. 6.37 Step 1 of process clubhouse payroll system Step2. You also put your face in front of our camera. Our database will search your login and logout time for calculates the price for clubhouse payment. Fig. 6.38 Step 2 of process of clubhouse payroll system 57

Step3. When you pay the money to our staff, our database should store your payment record. Fig. 6.39 Step 3 of process of clubhouse payroll system 58

Chapter 7 Verification of the Multi-Biometrics Recognition Systems 7.1 Overview In this part, we would like to represent our system s verification result of facial recognition. We will test it 20 times to get the result of its FAR and FRR. It cans test the reliable and accuracy of the system. 7.2 Verification of Result FAR and FRR of Facial recognition: No. of correct acceptance (a) No. of false rejection (b) False Rejection Rate (FRR) b / (a + b) 15 5 0.25 Table 7.1 FRR rate of facial recognition No. of correct rejection (a) No. of false acceptance (b) False Acceptance Rate (FAR) b / (a + b) 20 0 0 Table 7.2 FAR rate of facial recognition 7.3 Summary To summarize, the FRR of facial recognition is a little bit high. It is 0.25%. Sometimes, it cannot verify properly. It is because the light, glasses, cap may affect the system to verify. Although the FRR is a little bit high, the FAR is 0. It shows that the system have a high reliable. And the system have a high accuracy to verify the user. 59

Chapter 8 Conclusions and Further Development 8.1 Overview Base on the important of biometrics technology, it is popular and user-friendly to displace many older technologies and systems in the future technology development. 8.2 Contribution of Final Year Project The achievements and contributions of this project can be summarizes as follows:- We are developed the three parts of the recognition system. There are Administration Tools, Building Security System and Clubhouse System. It is ready to apply in the building. This recognition is convenience and safety for security management. We also need to improve our technology, security and method for biometrics system built up process and developed any great ideas. They are no need to remember the word of password for house entry. It is because the entry password always changed a time. The householder may forget the password or remember the wrong one. Now, they only use their face to make an entry and no need to bring smartcard and remember the password. 8.3 Discussion on the Project Limitation When a person sometime wears glasses, sometime not wear glasses. Our facial recognition system may verify failed for their glasses or cap. It is because our system is followed the capture face data to compare the person s face. So, the person enrolls the face record that he has no wear any glasses or anything on his face. If the person wears glasses or cap to verify, it may verify failed. On the other hand, if the area has not enough light or in a dark area. It also may distort the verify %. It may verify failed. It is because if the area has not enough light, then the camera cannot capture the face data fully and immediately. 60

8.4 Further Proposal After this project, we have other further ideas. The further ideas are below:- Administration Tools can generate the report of householder or visitor. Add Chinese interface of the building security system. Send the email or signal to householder when visitor come. Payroll monthly statement for members. Car entry and exit recognition system for car park Use face recognition to identify the householder and open the gate Record the entry and exit log for security The householder no need to bring the car park card for entry used 61

References [1] Introduction of Biometrics http://www.hrsltd.com/identification_technology/biometrics.htm [2] History of Biometrics http://library.thinkquest.org/tq0313041/scrottyhistory.htm [3] How does it work? http://www.findbiometrics.com/pages/guide2.html [4] Applications in Biometrics http://www.findbiometrics.com/index.html#applications [5] Fig. 2.1 Biometric identification and encrypted data system http://www.pressi.com/gb/image/61510.html [6] Fig. 2.2 Biometric access control system (Exys Security system) http://www.exys.co.za/resume.html [7] Fig. 2.3 Country entry and exit control system http://www.komotv.com/news/story.asp?id=17825 [8] Fig. 2.4 Hand geometry control system http://www.inspectech.us/securitysolutions_biometric.cfm [9] Fig. 2.5 Biometric experiment system http://www.intellisystem.it/eventi/timcatania2003/tim2003.htm [10] Fig. 2.6 Presse Fotos ekey fingerprint system http://www.ekey.at/presse/fotos.asp [11] Fig. 2.7 Biometric reader clocking system http://www.tensor.co.uk/english/biometric-clocking-system.htm [12] Fig. 2.8 Office access control system http://www.clarinetsys.com/en/kiosk.htm [13] Fig. 2.9 Windows lcqon recognition system http://www.acroprint.com/acroprintstore/solutions/biometrics-faq.aspx [14] Fig. 2.10 Breaker facial searching system http://www.asia-soft.com/frs/en/projects/obraz/ [15] Fig. 2.11 Biometric Patient Tracking System http://www.questbiometrics.com/biometrics-timekeeper-software.html [16] Fig. 2.12 fingerid system with biometrics in USA http://msnbc.msn.com/id/3999879 [17] Introduction of fingerprint recognition http://www.bergdata.com/downloads/introduction%20to%20fingerprint.pdf [18] Fig. 3.1 Types of fingerprint 62

[19] Fig. 3.2 Optical Fingerprint Sensors http://www.bergdata.com/downloads/introduction%20to%20fingerprint.pdf [20] Fig. 3.3 Surface Pressure Sensor http://www.bergdata.com/downloads/introduction%20to%20fingerprint.pdf [21] Fig. 3.4 Capacitive Sensors http://www.bergdata.com/downloads/introduction%20to%20fingerprint.pdf [22] Introduction of facial recognition http://www.findbiometrics.com/pages/face_articles/face_2.html http://www.c-vis.com/htd/frt.html [23] Fig. 3.5 Facial geometry example http://www.c-vis.com/htd/frt.html [24] Fig. 3.6 Correct recognition example http://www.c-vis.com/htd/frt.html [25] Fig. 3.7 Facial recognition in airport http://www.c-vis.com/htd/frt.html [26] Fig. 4.1 Marcomedia Flash http://www.adobe.com/products/flash/flashpro/ [27] Fig. 4.2 Adobe Photoshop http://www.adobe.com/products/photoshop/ [28] Fig. 4.3 Visual Basic 6.0 http://msdn.microsoft.com/vbrun/ Tutorial and example of VB and MySQL http://www.vbmysql.com Tutorial of embedded Flash in VB6 http://www.adobe.com/devnet/flash/articles/flash_vb.pdf http://www.vbcode.com 63

Appendices Appendix A: Team member workload Chan Ka Lun, Peae (leader) Design interface of Householder mode Design interface of Visitor mode Design interface of enrolment mode Design interface of administrator mode Programming of Householder mode Programming of Visitor mode Programming of enrolment mode Programming of administrator mode Build up database system Tsang Man Piu Design interface of Clubhouse login system Design interface of Clubhouse payroll system Programming of Clubhouse login system Programming of Clubhouse payroll system 64

Appendix B: Project plan PROJECT PLAN Course : 41381/3A Student Name : Chan Ka Lun, Tsang Man Piu Project Title : Apply Multi-Biometrics Recognition Systems for Intelligent House Management Project Supervisor : Mr. MK Lam Date : 7 October, 2005 (Week 4) Project Objective(s) : - Developed to use human s face and fingerprint to in place of the words of password and key. - Development of Multi-Biometrics Recognition System to instead of traditional security Survey & Research Work flow & Database draft design Interface draft design Read SmartGate s manual and SDK Read Futronic Fingerprint SDK Database & Interface programming Programming Week No. 2 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36 38 Testing Project report & presentation Project Resources Plan Equipment: PC with development environment Webcam Fingerprint device Touch screen Tools: Microsoft Visio for drawing diagram Microsoft Word for typing report Microsoft PowerPoint for presentation Adobe Photoshop for interface design Macromedia Flash for interface design Microsoft Visual Basic 6.0 for system programming Titanium SmartGate Biometric System SDK Futronic Fingerprint SDK 65

Appendix C: Programming code The class module of system CRijndael.cls This class module is used to generate the 64 character filename of the template. 1 Option Explicit 2 3 Private m_lonbits(30) As Long 4 Private m_l2power(30) As Long 5 Private m_bytonbits(7) As Byte 6 Private m_byt2power(7) As Byte 7 8 Private m_inco(3) As Byte 9 10 Private m_fbsub(255) As Byte 11 Private m_rbsub(255) As Byte 12 Private m_ptab(255) As Byte 13 Private m_ltab(255) As Byte 14 Private m_ftable(255) As Long 15 Private m_rtable(255) As Long 16 Private m_rco(29) As Long 17 18 Private m_nk As Long 19 Private m_nb As Long 20 Private m_nr As Long 21 Private m_fi(23) As Byte 22 Private m_ri(23) As Byte 23 Private m_fkey(119) As Long 24 Private m_rkey(119) As Long 25 26 Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ 27 (ByVal Destination As Any, ByVal Source As Any, ByVal Length As Long) 28 29 '******************************************************************************* 30 ' Class_Initialize (SUB) 31 '******************************************************************************* 32 Private Sub Class_Initialize() 33 m_inco(0) = &HB 34 m_inco(1) = &HD 35 m_inco(2) = &H9 36 m_inco(3) = &HE 37 38 ' Could have done this with a loop calculating each value, but simply 39 ' assigning the values is quicker - BITS SET FROM RIGHT 40 m_bytonbits(0) = 1 ' 00000001 41 m_bytonbits(1) = 3 ' 00000011 42 m_bytonbits(2) = 7 ' 00000111 43 m_bytonbits(3) = 15 ' 00001111 44 m_bytonbits(4) = 31 ' 00011111 45 m_bytonbits(5) = 63 ' 00111111 46 m_bytonbits(6) = 127 ' 01111111 47 m_bytonbits(7) = 255 ' 11111111 48 49 ' Could have done this with a loop calculating each value, but simply 50 ' assigning the values is quicker - POWERS OF 2 51 m_byt2power(0) = 1 ' 00000001 52 m_byt2power(1) = 2 ' 00000010 53 m_byt2power(2) = 4 ' 00000100 54 m_byt2power(3) = 8 ' 00001000 55 m_byt2power(4) = 16 ' 00010000 56 m_byt2power(5) = 32 ' 00100000 57 m_byt2power(6) = 64 ' 01000000 58 m_byt2power(7) = 128 ' 10000000 59 60 ' Could have done this with a loop calculating each value, but simply 61 ' assigning the values is quicker - BITS SET FROM RIGHT 62 m_lonbits(0) = 1 ' 00000000000000000000000000000001 63 m_lonbits(1) = 3 ' 00000000000000000000000000000011 64 m_lonbits(2) = 7 ' 00000000000000000000000000000111 66

65 m_lonbits(3) = 15 ' 00000000000000000000000000001111 66 m_lonbits(4) = 31 ' 00000000000000000000000000011111 67 m_lonbits(5) = 63 ' 00000000000000000000000000111111 68 m_lonbits(6) = 127 ' 00000000000000000000000001111111 69 m_lonbits(7) = 255 ' 00000000000000000000000011111111 70 m_lonbits(8) = 511 ' 00000000000000000000000111111111 71 m_lonbits(9) = 1023 ' 00000000000000000000001111111111 72 m_lonbits(10) = 2047 ' 00000000000000000000011111111111 73 m_lonbits(11) = 4095 ' 00000000000000000000111111111111 74 m_lonbits(12) = 8191 ' 00000000000000000001111111111111 75 m_lonbits(13) = 16383 ' 00000000000000000011111111111111 76 m_lonbits(14) = 32767 ' 00000000000000000111111111111111 77 m_lonbits(15) = 65535 ' 00000000000000001111111111111111 78 m_lonbits(16) = 131071 ' 00000000000000011111111111111111 79 m_lonbits(17) = 262143 ' 00000000000000111111111111111111 80 m_lonbits(18) = 524287 ' 00000000000001111111111111111111 81 m_lonbits(19) = 1048575 ' 00000000000011111111111111111111 82 m_lonbits(20) = 2097151 ' 00000000000111111111111111111111 83 m_lonbits(21) = 4194303 ' 00000000001111111111111111111111 84 m_lonbits(22) = 8388607 ' 00000000011111111111111111111111 85 m_lonbits(23) = 16777215 ' 00000000111111111111111111111111 86 m_lonbits(24) = 33554431 ' 00000001111111111111111111111111 87 m_lonbits(25) = 67108863 ' 00000011111111111111111111111111 88 m_lonbits(26) = 134217727 ' 00000111111111111111111111111111 89 m_lonbits(27) = 268435455 ' 00001111111111111111111111111111 90 m_lonbits(28) = 536870911 ' 00011111111111111111111111111111 91 m_lonbits(29) = 1073741823 ' 00111111111111111111111111111111 92 m_lonbits(30) = 2147483647 ' 01111111111111111111111111111111 93 94 ' Could have done this with a loop calculating each value, but simply 95 ' assigning the values is quicker - POWERS OF 2 96 m_l2power(0) = 1 ' 00000000000000000000000000000001 97 m_l2power(1) = 2 ' 00000000000000000000000000000010 98 m_l2power(2) = 4 ' 00000000000000000000000000000100 99 m_l2power(3) = 8 ' 00000000000000000000000000001000 100 m_l2power(4) = 16 ' 00000000000000000000000000010000 101 m_l2power(5) = 32 ' 00000000000000000000000000100000 102 m_l2power(6) = 64 ' 00000000000000000000000001000000 103 m_l2power(7) = 128 ' 00000000000000000000000010000000 104 m_l2power(8) = 256 ' 00000000000000000000000100000000 105 m_l2power(9) = 512 ' 00000000000000000000001000000000 106 m_l2power(10) = 1024 ' 00000000000000000000010000000000 107 m_l2power(11) = 2048 ' 00000000000000000000100000000000 108 m_l2power(12) = 4096 ' 00000000000000000001000000000000 109 m_l2power(13) = 8192 ' 00000000000000000010000000000000 110 m_l2power(14) = 16384 ' 00000000000000000100000000000000 111 m_l2power(15) = 32768 ' 00000000000000001000000000000000 112 m_l2power(16) = 65536 ' 00000000000000010000000000000000 113 m_l2power(17) = 131072 ' 00000000000000100000000000000000 114 m_l2power(18) = 262144 ' 00000000000001000000000000000000 115 m_l2power(19) = 524288 ' 00000000000010000000000000000000 116 m_l2power(20) = 1048576 ' 00000000000100000000000000000000 117 m_l2power(21) = 2097152 ' 00000000001000000000000000000000 118 m_l2power(22) = 4194304 ' 00000000010000000000000000000000 119 m_l2power(23) = 8388608 ' 00000000100000000000000000000000 120 m_l2power(24) = 16777216 ' 00000001000000000000000000000000 121 m_l2power(25) = 33554432 ' 00000010000000000000000000000000 122 m_l2power(26) = 67108864 ' 00000100000000000000000000000000 123 m_l2power(27) = 134217728 ' 00001000000000000000000000000000 124 m_l2power(28) = 268435456 ' 00010000000000000000000000000000 125 m_l2power(29) = 536870912 ' 00100000000000000000000000000000 126 m_l2power(30) = 1073741824 ' 01000000000000000000000000000000 127 End Sub 128 129 '******************************************************************************* 130 ' LShift (FUNCTION) 131 '******************************************************************************* 132 Private Function LShift(ByVal lvalue As Long, _ 133 ByVal ishiftbits As Integer) As Long 134 If ishiftbits = 0 Then 135 LShift = lvalue 136 Exit Function 137 ElseIf ishiftbits = 31 Then 138 If lvalue And 1 Then 139 LShift = &H80000000 140 Else 67

141 LShift = 0 142 End If 143 Exit Function 144 ElseIf ishiftbits < 0 Or ishiftbits > 31 Then 145 Err.Raise 6 146 End If 147 148 If (lvalue And m_l2power(31 - ishiftbits)) Then 149 LShift = ((lvalue And m_lonbits(31 - (ishiftbits + 1))) * _ 150 m_l2power(ishiftbits)) Or &H80000000 151 Else 152 LShift = ((lvalue And m_lonbits(31 - ishiftbits)) * _ 153 m_l2power(ishiftbits)) 154 End If 155 End Function 156 157 '******************************************************************************* 158 ' RShift (FUNCTION) 159 '******************************************************************************* 160 Private Function RShift(ByVal lvalue As Long, _ 161 ByVal ishiftbits As Integer) As Long 162 If ishiftbits = 0 Then 163 RShift = lvalue 164 Exit Function 165 ElseIf ishiftbits = 31 Then 166 If lvalue And &H80000000 Then 167 RShift = 1 168 Else 169 RShift = 0 170 End If 171 Exit Function 172 ElseIf ishiftbits < 0 Or ishiftbits > 31 Then 173 Err.Raise 6 174 End If 175 176 RShift = (lvalue And &H7FFFFFFE) \ m_l2power(ishiftbits) 177 178 If (lvalue And &H80000000) Then 179 RShift = (RShift Or (&H40000000 \ m_l2power(ishiftbits - 1))) 180 End If 181 End Function 182 183 '******************************************************************************* 184 ' LShiftByte (FUNCTION) 185 '******************************************************************************* 186 Private Function LShiftByte(ByVal bytvalue As Byte, _ 187 ByVal bytshiftbits As Byte) As Byte 188 If bytshiftbits = 0 Then 189 LShiftByte = bytvalue 190 Exit Function 191 ElseIf bytshiftbits = 7 Then 192 If bytvalue And 1 Then 193 LShiftByte = &H80 194 Else 195 LShiftByte = 0 196 End If 197 Exit Function 198 ElseIf bytshiftbits < 0 Or bytshiftbits > 7 Then 199 Err.Raise 6 200 End If 201 202 LShiftByte = ((bytvalue And m_bytonbits(7 - bytshiftbits)) * _ 203 m_byt2power(bytshiftbits)) 204 End Function 205 206 '******************************************************************************* 207 ' RShiftByte (FUNCTION) 208 '******************************************************************************* 209 Private Function RShiftByte(ByVal bytvalue As Byte, _ 210 ByVal bytshiftbits As Byte) As Byte 211 If bytshiftbits = 0 Then 212 RShiftByte = bytvalue 213 Exit Function 214 ElseIf bytshiftbits = 7 Then 215 If bytvalue And &H80 Then 216 RShiftByte = 1 68

217 Else 218 RShiftByte = 0 219 End If 220 Exit Function 221 ElseIf bytshiftbits < 0 Or bytshiftbits > 7 Then 222 Err.Raise 6 223 End If 224 225 RShiftByte = bytvalue \ m_byt2power(bytshiftbits) 226 End Function 227 228 '******************************************************************************* 229 ' RotateLeft (FUNCTION) 230 '******************************************************************************* 231 Private Function RotateLeft(ByVal lvalue As Long, _ 232 ByVal ishiftbits As Integer) As Long 233 RotateLeft = LShift(lValue, ishiftbits) Or RShift(lValue, (32 - ishiftbits)) 234 End Function 235 236 ''******************************************************************************* 237 '' RotateLeftByte (FUNCTION) 238 '******************************************************************************* 239 Private Function RotateLeftByte(ByVal bytvalue As Byte, _ 240 ByVal bytshiftbits As Byte) As Byte 241 RotateLeftByte = LShiftByte(bytValue, bytshiftbits) Or _ 242 RShiftByte(bytValue, (8 - bytshiftbits)) 243 End Function 244 245 '******************************************************************************* 246 ' Pack (FUNCTION) 247 '******************************************************************************* 248 Private Function Pack(b() As Byte) As Long 249 Dim lcount As Long 250 Dim ltemp As Long 251 252 For lcount = 0 To 3 253 ltemp = b(lcount) 254 Pack = Pack Or LShift(lTemp, (lcount * 8)) 255 Next 256 End Function 257 258 '******************************************************************************* 259 ' PackFrom (FUNCTION) 260 '******************************************************************************* 261 Private Function PackFrom(b() As Byte, _ 262 ByVal k As Long) As Long 263 Dim lcount As Long 264 Dim ltemp As Long 265 266 For lcount = 0 To 3 267 ltemp = b(lcount + k) 268 PackFrom = PackFrom Or LShift(lTemp, (lcount * 8)) 269 Next 270 End Function 271 272 '******************************************************************************* 273 ' Unpack (SUB) 274 '******************************************************************************* 275 Private Sub Unpack(ByVal a As Long, _ 276 b() As Byte) 277 b(0) = a And m_lonbits(7) 278 b(1) = RShift(a, 8) And m_lonbits(7) 279 b(2) = RShift(a, 16) And m_lonbits(7) 280 b(3) = RShift(a, 24) And m_lonbits(7) 281 End Sub 282 283 '******************************************************************************* 284 ' UnpackFrom (SUB) 285 '******************************************************************************* 286 Private Sub UnpackFrom(ByVal a As Long, _ 287 b() As Byte, _ 288 ByVal k As Long) 289 b(0 + k) = a And m_lonbits(7) 290 b(1 + k) = RShift(a, 8) And m_lonbits(7) 291 b(2 + k) = RShift(a, 16) And m_lonbits(7) 292 b(3 + k) = RShift(a, 24) And m_lonbits(7) 69

293 End Sub 294 295 '******************************************************************************* 296 ' xtime (FUNCTION) 297 '******************************************************************************* 298 Private Function xtime(byval a As Byte) As Byte 299 Dim b As Byte 300 301 If (a And &H80) Then 302 b = &H1B 303 Else 304 b = 0 305 End If 306 307 a = LShiftByte(a, 1) 308 a = a Xor b 309 310 xtime = a 311 End Function 312 313 '******************************************************************************* 314 ' bmul (FUNCTION) 315 '******************************************************************************* 316 Private Function bmul(byval x As Byte, _ 317 y As Byte) As Byte 318 If x <> 0 And y <> 0 Then 319 bmul = m_ptab((clng(m_ltab(x)) + CLng(m_ltab(y))) Mod 255) 320 Else 321 bmul = 0 322 End If 323 End Function 324 325 '******************************************************************************* 326 ' SubByte (FUNCTION) 327 '******************************************************************************* 328 Private Function SubByte(ByVal a As Long) As Long 329 Dim b(3) As Byte 330 331 Unpack a, b 332 b(0) = m_fbsub(b(0)) 333 b(1) = m_fbsub(b(1)) 334 b(2) = m_fbsub(b(2)) 335 b(3) = m_fbsub(b(3)) 336 337 SubByte = Pack(b) 338 End Function 339 340 '******************************************************************************* 341 ' product (FUNCTION) 342 '******************************************************************************* 343 Private Function product(byval x As Long, _ 344 ByVal y As Long) As Long 345 Dim xb(3) As Byte 346 Dim yb(3) As Byte 347 348 Unpack x, xb 349 Unpack y, yb 350 product = bmul(xb(0), yb(0)) Xor bmul(xb(1), yb(1)) Xor bmul(xb(2), yb(2)) _ 351 Xor bmul(xb(3), yb(3)) 352 End Function 353 354 '******************************************************************************* 355 ' InvMixCol (FUNCTION) 356 '******************************************************************************* 357 Private Function InvMixCol(ByVal x As Long) As Long 358 Dim y As Long 359 Dim m As Long 360 Dim b(3) As Byte 361 362 m = Pack(m_InCo) 363 b(3) = product(m, x) 364 m = RotateLeft(m, 24) 365 b(2) = product(m, x) 366 m = RotateLeft(m, 24) 367 b(1) = product(m, x) 368 m = RotateLeft(m, 24) 70

369 b(0) = product(m, x) 370 y = Pack(b) 371 372 InvMixCol = y 373 End Function 374 375 '******************************************************************************* 376 ' ByteSub (FUNCTION) 377 '******************************************************************************* 378 Private Function ByteSub(ByVal x As Byte) As Byte 379 Dim y As Byte 380 381 y = m_ptab(255 - m_ltab(x)) 382 x = y 383 x = RotateLeftByte(x, 1) 384 y = y Xor x 385 x = RotateLeftByte(x, 1) 386 y = y Xor x 387 x = RotateLeftByte(x, 1) 388 y = y Xor x 389 x = RotateLeftByte(x, 1) 390 y = y Xor x 391 y = y Xor &H63 392 393 ByteSub = y 394 End Function 395 396 '******************************************************************************* 397 ' gentables (SUB) 398 '******************************************************************************* 399 Public Sub gentables() 400 Dim i As Long 401 Dim y As Byte 402 Dim b(3) As Byte 403 Dim ib As Byte 404 405 m_ltab(0) = 0 406 m_ptab(0) = 1 407 m_ltab(1) = 0 408 m_ptab(1) = 3 409 m_ltab(3) = 1 410 411 For i = 2 To 255 412 m_ptab(i) = m_ptab(i - 1) Xor xtime(m_ptab(i - 1)) 413 m_ltab(m_ptab(i)) = i 414 Next 415 416 m_fbsub(0) = &H63 417 m_rbsub(&h63) = 0 418 419 For i = 1 To 255 420 ib = i 421 y = ByteSub(ib) 422 m_fbsub(i) = y 423 m_rbsub(y) = i 424 Next 425 426 y = 1 427 For i = 0 To 29 428 m_rco(i) = y 429 y = xtime(y) 430 Next 431 432 For i = 0 To 255 433 y = m_fbsub(i) 434 b(3) = y Xor xtime(y) 435 b(2) = y 436 b(1) = y 437 b(0) = xtime(y) 438 m_ftable(i) = Pack(b) 439 440 y = m_rbsub(i) 441 b(3) = bmul(m_inco(0), y) 442 b(2) = bmul(m_inco(1), y) 443 b(1) = bmul(m_inco(2), y) 444 b(0) = bmul(m_inco(3), y) 71

445 m_rtable(i) = Pack(b) 446 Next 447 End Sub 448 449 '******************************************************************************* 450 ' gkey (SUB) 451 '******************************************************************************* 452 Public Sub gkey(byval nb As Long, _ 453 ByVal nk As Long, _ 454 key() As Byte) 455 456 Dim i As Long 457 Dim j As Long 458 Dim k As Long 459 Dim m As Long 460 Dim N As Long 461 Dim C1 As Long 462 Dim C2 As Long 463 Dim C3 As Long 464 Dim CipherKey(7) As Long 465 466 m_nb = nb 467 m_nk = nk 468 469 If m_nb >= m_nk Then 470 m_nr = 6 + m_nb 471 Else 472 m_nr = 6 + m_nk 473 End If 474 475 C1 = 1 476 If m_nb < 8 Then 477 C2 = 2 478 C3 = 3 479 Else 480 C2 = 3 481 C3 = 4 482 End If 483 484 For j = 0 To nb - 1 485 m = j * 3 486 487 m_fi(m) = (j + C1) Mod nb 488 m_fi(m + 1) = (j + C2) Mod nb 489 m_fi(m + 2) = (j + C3) Mod nb 490 m_ri(m) = (nb + j - C1) Mod nb 491 m_ri(m + 1) = (nb + j - C2) Mod nb 492 m_ri(m + 2) = (nb + j - C3) Mod nb 493 Next 494 495 N = m_nb * (m_nr + 1) 496 497 For i = 0 To m_nk - 1 498 j = i * 4 499 CipherKey(i) = PackFrom(key, j) 500 Next 501 502 For i = 0 To m_nk - 1 503 m_fkey(i) = CipherKey(i) 504 Next 505 506 j = m_nk 507 k = 0 508 Do While j < N 509 m_fkey(j) = m_fkey(j - m_nk) Xor _ 510 SubByte(RotateLeft(m_fkey(j - 1), 24)) Xor m_rco(k) 511 If m_nk <= 6 Then 512 i = 1 513 Do While i < m_nk And (i + j) < N 514 m_fkey(i + j) = m_fkey(i + j - m_nk) Xor _ 515 m_fkey(i + j - 1) 516 i = i + 1 517 Loop 518 Else 519 ' Problem fixed here 520 i = 1 72

521 Do While i < 4 And (i + j) < N 522 m_fkey(i + j) = m_fkey(i + j - m_nk) Xor _ 523 m_fkey(i + j - 1) 524 i = i + 1 525 Loop 526 If j + 4 < N Then 527 m_fkey(j + 4) = m_fkey(j + 4 - m_nk) Xor _ 528 SubByte(m_fkey(j + 3)) 529 End If 530 i = 5 531 Do While i < m_nk And (i + j) < N 532 m_fkey(i + j) = m_fkey(i + j - m_nk) Xor _ 533 m_fkey(i + j - 1) 534 i = i + 1 535 Loop 536 End If 537 538 j = j + m_nk 539 k = k + 1 540 Loop 541 542 For j = 0 To m_nb - 1 543 m_rkey(j + N - nb) = m_fkey(j) 544 Next 545 546 i = m_nb 547 Do While i < N - m_nb 548 k = N - m_nb - i 549 For j = 0 To m_nb - 1 550 m_rkey(k + j) = InvMixCol(m_fkey(i + j)) 551 Next 552 i = i + m_nb 553 Loop 554 555 j = N - m_nb 556 Do While j < N 557 m_rkey(j - N + m_nb) = m_fkey(j) 558 j = j + 1 559 Loop 560 End Sub 561 562 '******************************************************************************* 563 ' encrypt (SUB) 564 '******************************************************************************* 565 Public Sub Encrypt(buff() As Byte) 566 Dim i As Long 567 Dim j As Long 568 Dim k As Long 569 Dim m As Long 570 Dim a(7) As Long 571 Dim b(7) As Long 572 Dim x() As Long 573 Dim y() As Long 574 Dim t() As Long 575 576 For i = 0 To m_nb - 1 577 j = i * 4 578 579 a(i) = PackFrom(buff, j) 580 a(i) = a(i) Xor m_fkey(i) 581 Next 582 583 k = m_nb 584 x = a 585 y = b 586 587 For i = 1 To m_nr - 1 588 For j = 0 To m_nb - 1 589 m = j * 3 590 y(j) = m_fkey(k) Xor m_ftable(x(j) And m_lonbits(7)) Xor _ 591 RotateLeft(m_ftable(RShift(x(m_fi(m)), 8) And m_lonbits(7)), 8) Xor _ 592 RotateLeft(m_ftable(RShift(x(m_fi(m + 1)), 16) And m_lonbits(7)), 16) Xor _ 593 RotateLeft(m_ftable(RShift(x(m_fi(m + 2)), 24) And m_lonbits(7)), 24) 594 k = k + 1 595 Next 73

596 t = x 597 x = y 598 y = t 599 Next 600 601 For j = 0 To m_nb - 1 602 m = j * 3 603 y(j) = m_fkey(k) Xor m_fbsub(x(j) And m_lonbits(7)) Xor _ 604 RotateLeft(m_fbsub(RShift(x(m_fi(m)), 8) And m_lonbits(7)), 8) Xor _ 605 RotateLeft(m_fbsub(RShift(x(m_fi(m + 1)), 16) And m_lonbits(7)), 16) Xor _ 606 RotateLeft(m_fbsub(RShift(x(m_fi(m + 2)), 24) And m_lonbits(7)), 24) 607 k = k + 1 608 Next 609 610 For i = 0 To m_nb - 1 611 j = i * 4 612 UnpackFrom y(i), buff, j 613 x(i) = 0 614 y(i) = 0 615 Next 616 End Sub 617 618 '******************************************************************************* 619 ' decrypt (SUB) 620 '******************************************************************************* 621 Public Sub Decrypt(buff() As Byte) 622 Dim i As Long 623 Dim j As Long 624 Dim k As Long 625 Dim m As Long 626 Dim a(7) As Long 627 Dim b(7) As Long 628 Dim x() As Long 629 Dim y() As Long 630 Dim t() As Long 631 632 For i = 0 To m_nb - 1 633 j = i * 4 634 a(i) = PackFrom(buff, j) 635 a(i) = a(i) Xor m_rkey(i) 636 Next 637 638 k = m_nb 639 x = a 640 y = b 641 642 For i = 1 To m_nr - 1 643 For j = 0 To m_nb - 1 644 m = j * 3 645 y(j) = m_rkey(k) Xor m_rtable(x(j) And m_lonbits(7)) Xor _ 646 RotateLeft(m_rtable(RShift(x(m_ri(m)), 8) And m_lonbits(7)), 8) Xor _ 647 RotateLeft(m_rtable(RShift(x(m_ri(m + 1)), 16) And m_lonbits(7)), 16) Xor _ 648 RotateLeft(m_rtable(RShift(x(m_ri(m + 2)), 24) And m_lonbits(7)), 24) 649 k = k + 1 650 Next 651 t = x 652 x = y 653 y = t 654 Next 655 656 For j = 0 To m_nb - 1 657 m = j * 3 658 659 y(j) = m_rkey(k) Xor m_rbsub(x(j) And m_lonbits(7)) Xor _ 660 RotateLeft(m_rbsub(RShift(x(m_ri(m)), 8) And m_lonbits(7)), 8) Xor _ 661 RotateLeft(m_rbsub(RShift(x(m_ri(m + 1)), 16) And m_lonbits(7)), 16) Xor _ 662 RotateLeft(m_rbsub(RShift(x(m_ri(m + 2)), 24) And m_lonbits(7)), 24) 663 k = k + 1 664 Next 665 666 For i = 0 To m_nb - 1 667 j = i * 4 668 669 UnpackFrom y(i), buff, j 670 x(i) = 0 74

671 y(i) = 0 672 Next 673 End Sub 674 675 ''******************************************************************************* 676 '' CopyBytesASP (SUB) 677 '' 678 '' Slower non-api function you can use to copy array data 679 ''******************************************************************************* 680 'Private Sub CopyBytesASP(bytDest() As Byte, _ 681 ' ldeststart As Long, _ 682 ' bytsource() As Byte, _ 683 ' lsourcestart As Long, _ 684 ' llength As Long) 685 ' Dim lcount As Long 686 ' 687 ' lcount = 0 688 ' Do 689 ' bytdest(ldeststart + lcount) = bytsource(lsourcestart + lcount) 690 ' lcount = lcount + 1 691 ' Loop Until lcount = llength 692 'End Sub 693 694 '******************************************************************************* 695 ' IsInitialized (FUNCTION) 696 '******************************************************************************* 697 Private Function IsInitialized(ByRef varray As Variant) As Boolean 698 On Error Resume Next 699 700 IsInitialized = IsNumeric(UBound(vArray)) 701 End Function 702 703 '******************************************************************************* 704 ' EncryptData (FUNCTION) 705 ' 706 ' Takes the message, whatever the size, and password in one call and does 707 ' everything for you to return an encoded/encrypted message 708 '******************************************************************************* 709 Public Function EncryptData(bytMessage() As Byte, _ 710 bytpassword() As Byte) As Byte() 711 Dim bytkey(31) As Byte 712 Dim bytin() As Byte 713 Dim bytout() As Byte 714 Dim byttemp(31) As Byte 715 Dim lcount As Long 716 Dim llength As Long 717 Dim lencodedlength As Long 718 Dim bytlen(3) As Byte 719 Dim lposition As Long 720 721 If Not IsInitialized(bytMessage) Then 722 Exit Function 723 End If 724 If Not IsInitialized(bytPassword) Then 725 Exit Function 726 End If 727 728 ' Use first 32 bytes of the password for the key 729 For lcount = 0 To UBound(bytPassword) 730 bytkey(lcount) = bytpassword(lcount) 731 If lcount = 31 Then 732 Exit For 733 End If 734 Next 735 736 ' Prepare the key; assume 256 bit block and key size 737 gentables 738 gkey 8, 8, bytkey 739 740 ' We are going to put the message size on the front of the message 741 ' in the first 4 bytes. If the length is more than a max int we are 742 ' in trouble 743 llength = UBound(bytMessage) + 1 744 lencodedlength = llength + 4 745 746 ' The encoded length includes the 4 bytes stuffed on the front 75

747 ' and is padded out to be modulus 32 748 If lencodedlength Mod 32 <> 0 Then 749 lencodedlength = lencodedlength + 32 - (lencodedlength Mod 32) 750 End If 751 ReDim bytin(lencodedlength - 1) 752 ReDim bytout(lencodedlength - 1) 753 754 ' Put the length on the front 755 '* Unpack llength, bytin 756 CopyMemory VarPtr(bytIn(0)), VarPtr(lLength), 4 757 ' Put the rest of the message after it 758 '* CopyBytesASP bytin, 4, bytmessage, 0, llength 759 CopyMemory VarPtr(bytIn(4)), VarPtr(bytMessage(0)), llength 760 761 ' Encrypt a block at a time 762 For lcount = 0 To lencodedlength - 1 Step 32 763 '* CopyBytesASP byttemp, 0, bytin, lcount, 32 764 CopyMemory VarPtr(bytTemp(0)), VarPtr(bytIn(lCount)), 32 765 Encrypt byttemp 766 '* CopyBytesASP bytout, lcount, byttemp, 0, 32 767 CopyMemory VarPtr(bytOut(lCount)), VarPtr(bytTemp(0)), 32 768 Next 769 770 EncryptData = bytout 771 End Function 772 773 '******************************************************************************* 774 ' DecryptData (FUNCTION) 775 ' 776 ' Opposite of Encryptdata 777 '******************************************************************************* 778 Public Function DecryptData(bytIn() As Byte, _ 779 bytpassword() As Byte) As Byte() 780 Dim bytmessage() As Byte 781 Dim bytkey(31) As Byte 782 Dim bytout() As Byte 783 Dim byttemp(31) As Byte 784 Dim lcount As Long 785 Dim llength As Long 786 Dim lencodedlength As Long 787 Dim bytlen(3) As Byte 788 Dim lposition As Long 789 790 If Not IsInitialized(bytIn) Then 791 Exit Function 792 End If 793 If Not IsInitialized(bytPassword) Then 794 Exit Function 795 End If 796 797 lencodedlength = UBound(bytIn) + 1 798 799 If lencodedlength Mod 32 <> 0 Then 800 Exit Function 801 End If 802 803 ' Use first 32 bytes of the password for the key 804 For lcount = 0 To UBound(bytPassword) 805 bytkey(lcount) = bytpassword(lcount) 806 If lcount = 31 Then 807 Exit For 808 End If 809 Next 810 811 ' Prepare the key; assume 256 bit block and key size 812 gentables 813 gkey 8, 8, bytkey 814 815 ' The output array needs to be the same size as the input array 816 ReDim bytout(lencodedlength - 1) 817 818 ' Decrypt a block at a time 819 For lcount = 0 To lencodedlength - 1 Step 32 820 '* CopyBytesASP byttemp, 0, bytin, lcount, 32 821 CopyMemory VarPtr(bytTemp(0)), VarPtr(bytIn(lCount)), 32 822 Decrypt byttemp 76

823 '* CopyBytesASP bytout, lcount, byttemp, 0, 32 824 CopyMemory VarPtr(bytOut(lCount)), VarPtr(bytTemp(0)), 32 825 Next 826 827 ' Get the original length of the string from the first 4 bytes 828 '* llength = Pack(bytOut) 829 CopyMemory VarPtr(lLength), VarPtr(bytOut(0)), 4 830 831 ' Make sure the length is consistent with our data 832 If llength > lencodedlength - 4 Then 833 Exit Function 834 End If 835 836 ' Prepare the output message byte array 837 ReDim bytmessage(llength - 1) 838 '* CopyBytesASP bytmessage, 0, bytout, 4, llength 839 CopyMemory VarPtr(bytMessage(0)), VarPtr(bytOut(4)), llength 840 841 DecryptData = bytmessage 842 End Function The modules of Futronic fingerprint in Building Security System FP_BiOpers.bas Control of Futronic fingerprint scanner 1 Public Const INVALID_HANDLE_VALUE = -1 2 3 Declare Function VarPtrArray Lib "msvbvm60.dll" Alias "VarPtr" (Var() As Any) As Long 4 Declare Function VarPtr Lib "msvbvm60.dll" (Var As Any) As Long 5 6 Public Declare Function MessageBeep Lib "user32" (ByVal wtype As Long) As Long 7 Public Declare Function UpdateWindow Lib "user32" (ByVal hwnd As Long) As Long 8 Public LastSignal As Long 9 10 Dim i As Integer 11 12 13 ' 14 ' cbcontrol - user's callback function for control the enrollment or 15 ' verification execution flow. 16 ' Argument list: 17 ' usrcontext (input) - user-defined context information; 18 ' StateMask (input) - a bit mask indicating what arguments are provided; 19 ' presponse (output) - API function execution control is achieved through 20 ' this value; 21 ' Signal (input) - this signal should be used to interact with a user; 22 ' pbitmap (input) - a pointer to the bitmap to be displayed. 23 ' 24 Sub cbcontrol(byval usrcontext As Byte, ByVal StateMask As Long, ByVal presponse As Long, _ 25 ByVal Signal As Long, ByRef pbitmap As FTR_BITMAP) 26 27 ' frame show 28 If (StateMask And FTR_STATE_FRAME_PROVIDED) = FTR_STATE_FRAME_PROVIDED Then 29 UpdateImage (pbitmap.ftrbitmap.pdata) 30 End If 31 32 ' message print 33 If (StateMask And FTR_STATE_SIGNAL_PROVIDED) = FTR_STATE_SIGNAL_PROVIDED Then 34 If Signal <> LastSignal Then 35 Select Case Signal 36 Case FTR_SIGNAL_TOUCH_SENSOR 37 'Demo.messagebox.Caption = "Put your finger on the scaner" 38 i = i + 1 39 V_Mode.FingerImage.Picture = V_Mode.FingerImageList.ListImages(i).Picture 40 UpdateWindow V_Mode.hwnd 41 Case FTR_SIGNAL_TAKE_OFF 42 'Demo.messagebox.Caption = "Take off your finger from the scaner" 43 i = i + 1 44 V_Mode.FingerImage.Picture = V_Mode.FingerImageList.ListImages(i).Picture 45 UpdateWindow V_Mode.hwnd 77

46 End Select 47 LastSignal = Signal 48 End If 49 End If 50 51 presponse = FTR_CONTINUE 52 53 'reset the index of FingerImageList 54 If (i = 6) Then 55 i = 0 56 End If 57 58 59 End Sub FP_DataBase.bas It is used to save the fingerprint template to drive and insert record to database. 1 Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" _ 2 (Destination As Any, Source As Any, ByVal Length As Long) 3 4 ' 5 ' AddRecord - add new record to database. 6 ' Argument list: 7 ' data - pointer of data for store; 8 ' dlen - size of data. 9 Function AddFinger(data As Long, dlen As Long, path As String, filename As String) As Boolean 10 11 Dim key As String * 16 12 13 key = "tester" 14 15 ' write "DB record" LBound 16 FPName = path & filename & ".tml" 17 Open FPName For Binary Access Write As #1 18 Put #1,, dlen 19 Put #1,, key 20 Dim DataArr() As Byte 21 ReDim DataArr(dLen) 22 Call CopyMemory(DataArr(0), ByVal data, dlen) 23 Put #1,, DataArr 24 Close #1 25 26 End Function FP_SDK_API.bas It stores the API of Futronic fingerprint 1 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 2 ' 3 ' Futronic SDK types 4 ' 5 6 ' Generic byte data. 7 Type FTR_DATA 8 dwsize As Long ' Length of data in bytes. 9 pdata As Long ' Data pointer. 10 End Type 11 12 ' Futronic SDK image data 13 Type FTR_BITMAP 14 ftrwidth As Long ' width in pixels 15 ftrheight As Long ' height in pixels 16 ftrbitmap As FTR_DATA ' bitmap as FTR_DATA type 17 End Type 18 19 ' Array of identify records 20 Type FTR_IDENTIFY_ARRAY 21 TotalNumber As Long ' number of FTR_IDENTIFY_RECORD 22 pmembers As Long ' pointer on FTR_IDENTIFY_RECORD type 78

23 End Type 24 25 ' Identify record description 26 Type FTR_IDENTIFY_RECORD 27 KeyValue As String * 16 ' external key 28 pdata As Long ' pointer on FTR_DATA type 29 End Type 30 31 ' Match record description 32 Type FTR_MATCHED_RECORD 33 KeyValue As String * 16 ' external key 34 FarAttained As Long 35 End Type 36 37 ' Array of match records 38 Type FTR_MATCHED_ARRAY 39 TotalNumber As Long ' number of FTR_MATCHED_RECORD 40 pmembers As Long ' pointer on FTR_MATCHED_RECORD 41 End Type 42 43 44 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 45 ' 46 ' Futronic SDK constants 47 ' 48 49 ' Return code values. 50 Public Const FTR_RETCODE_ERROR_BASE As Integer = 1 ' Base value for the error codes. 51 Public Const FTR_RETCODE_DEVICE_BASE As Integer = 200 ' Base value for the device error codes. 52 53 Public Const FTR_RETCODE_OK As Integer = 0 ' Successful function completion. 54 55 Public Const FTR_RETCODE_NO_MEMORY As Integer = FTR_RETCODE_ERROR_BASE + 1 56 Public Const FTR_RETCODE_INVALID_ARG As Integer = FTR_RETCODE_ERROR_BASE + 2 57 Public Const FTR_RETCODE_ALREADY_IN_USE As Integer = FTR_RETCODE_ERROR_BASE + 3 58 Public Const FTR_RETCODE_INVALID_PURPOSE As Integer = FTR_RETCODE_ERROR_BASE + 4 59 Public Const FTR_RETCODE_INTERNAL_ERROR As Integer = FTR_RETCODE_ERROR_BASE + 5 60 Public Const FTR_RETCODE_UNABLE_TO_CAPTURE As Integer = FTR_RETCODE_ERROR_BASE + 6 61 Public Const FTR_RETCODE_CANCELED_BY_USER As Integer = FTR_RETCODE_ERROR_BASE + 7 62 Public Const FTR_RETCODE_NO_MORE_RETRIES As Integer = FTR_RETCODE_ERROR_BASE + 8 63 64 Public Const FTR_RETCODE_FRAME_SOURCE_NOT_SET As Integer = FTR_RETCODE_DEVICE_BASE + 1 65 Public Const FTR_RETCODE_DEVICE_NOT_CONNECTED As Integer = FTR_RETCODE_DEVICE_BASE + 2 66 Public Const FTR_RETCODE_DEVICE_FAILURE As Integer = FTR_RETCODE_DEVICE_BASE + 3 67 Public Const FTR_RETCODE_EMPTY_FRAME As Integer = FTR_RETCODE_DEVICE_BASE + 4 68 69 ' Values used for the parameter definition (FTRSetParam and FTRGetParam). 70 Public Const FTR_PARAM_IMAGE_WIDTH As Long = 1 71 Public Const FTR_PARAM_IMAGE_HEIGHT As Long = 2 72 Public Const FTR_PARAM_IMAGE_SIZE As Long = 3 73 Public Const FTR_PARAM_CB_FRAME_SOURCE As Long = 4 74 Public Const FTR_PARAM_CB_CONTROL As Long = 5 75 Public Const FTR_PARAM_MAX_TEMPLATE_SIZE As Long = 6 76 Public Const FTR_PARAM_MAX_FAR_REQUESTED As Long = 7 77 Public Const FTR_PARAM_MAX_MODELS As Long = 10 78 ' Available frame sources. These device identifiers are intended to be used 79 ' with the FTR_PARAM_CB_FRAME_SOURCE parameter. 80 Public Const FSD_FUTRONIC_USB As Long = 1 ' Futronic USB Fingerprint Scanner Device. 81 82 ' 83 ' User callback function definitions 84 ' 85 ' State bit mask values for user callback function. 86 Public Const FTR_STATE_FRAME_PROVIDED As Long = 1 87 Public Const FTR_STATE_SIGNAL_PROVIDED As Long = 2 88 ' Signal values. 89 Public Const FTR_SIGNAL_UNDEFINED As Long = 0 90 Public Const FTR_SIGNAL_TOUCH_SENSOR As Long = 1 91 Public Const FTR_SIGNAL_TAKE_OFF As Long = 2 92 ' Response values 93 Public Const FTR_CANCEL As Long = 1 94 Public Const FTR_CONTINUE As Long = 2 95 96 ' Values used for the purpose definition 97 Public Const FTR_PURPOSE_IDENTIFY As Long = 2 79

98 Public Const FTR_PURPOSE_ENROLL As Long = 3 99 100 101 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 102 ' 103 ' Futronic SDK function prototypes 104 ' 105 Declare Function FTRInitialize Lib "FtrAPI.DLL" () As Integer 106 Declare Function FTRTerminate Lib "FtrAPI.DLL" () As Integer 107 Declare Function FTRSetParam Lib "FtrAPI.DLL" _ 108 (ByVal Param As Long, ByVal value As Any) As Integer 109 Declare Function FTRGetParam Lib "FtrAPI.DLL" _ 110 (ByVal Param As Long, ByRef value As Any) As Integer 111 Declare Function FTRCaptureFrame Lib "FtrAPI.DLL" _ 112 (ByVal usrcontext As Any, ByRef pframebuf As Any) As Integer 113 Declare Function FTREnroll Lib "FtrAPI.DLL" _ 114 (ByVal usrcontext As Any, ByVal Purpose As Long, ByRef ptemplate As FTR_DATA) As Integer 115 Declare Function FTRVerify Lib "FtrAPI.DLL" _ 116 (ByVal usrcontext As Any, ByRef ptemplate As FTR_DATA, ByRef presult As Boolean, _ 117 ByRef pfarverify As Long) As Integer 118 Declare Function FTRSetBaseTemplate Lib "FtrAPI.DLL" _ 119 (ByRef ptemplate As FTR_DATA) As Integer 120 Declare Function FTRIdentify Lib "FtrAPI.DLL" _ 121 (ByRef paident As FTR_IDENTIFY_ARRAY, ByRef pdwmatchcnt As Long, _ 122 ByRef pamatch As FTR_MATCHED_ARRAY) As Long 123 FP_ViewWnd.bas It is used for create the area to show fingerprint image. 1 Public Const WM_PAINT = &HF 2 Public Const WM_ERASEBKGND = &H14 3 Public Const WM_DESTROY = &H2 4 Public Const COLOR_WINDOWTEXT = 8 5 Public Const WS_CHILD = &H40000000 6 Public Const WS_VISIBLE = &H10000000 7 Public Const WS_EX_DLGMODALFRAME = &H1& 8 Public Const BI_RGB = 0& 9 Public Const DIB_RGB_COLORS = 0 ' color table in RGBs 10 11 Public Type RECT 12 Left As Long 13 Top As Long 14 Right As Long 15 Bottom As Long 16 End Type 17 18 Public Type PAINTSTRUCT 19 hdc As Long 20 ferase As Long 21 rcpaint As RECT 22 frestore As Long 23 fincupdate As Long 24 rgbreserved(32) As Byte 25 End Type 26 27 Public Type WNDCLASS 28 style As Long 29 lpfnwndproc As Long 30 cbclsextra As Long 31 cbwndextra2 As Long 32 hinstance As Long 33 hicon As Long 34 hcursor As Long 35 hbrbackground As Long 36 lpszmenuname As String 37 lpszclassname As String 38 End Type 39 40 Public Type RGBQUAD 41 rgbblue As Byte 42 rgbgreen As Byte 43 rgbred As Byte 44 rgbreserved As Byte 80

45 End Type 46 47 Public Type PALETTEENTRY 48 pered As Byte 49 pegreen As Byte 50 peblue As Byte 51 peflags As Byte 52 End Type 53 54 Public Type LOGPALETTE 55 palversion As Integer 56 palnumentries As Integer 57 palpalentry(255) As PALETTEENTRY 58 End Type 59 60 Public Type BITMAPINFOHEADER '40 bytes 61 bisize As Long 62 biwidth As Long 63 biheight As Long 64 biplanes As Integer 65 bibitcount As Integer 66 bicompression As Long 67 bisizeimage As Long 68 bixpelspermeter As Long 69 biypelspermeter As Long 70 biclrused As Long 71 biclrimportant As Long 72 End Type 73 74 Public Type BITMAPINFO 75 bmiheader As BITMAPINFOHEADER 76 bmicolors As RGBQUAD 77 End Type 78 79 Public Declare Function BeginPaint Lib "user32" (ByVal hwnd As Long, lppaint As PAINTSTRUCT) As Long 80 81 Public Declare Function EndPaint Lib "user32" (ByVal hwnd As Long, lppaint As PAINTSTRUCT) As Long 82 83 Public Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" _ 84 (ByVal hwnd As Long, ByVal wmsg As Long, ByVal wparam As Long, ByVal lparam As Long) As Long 85 86 Public Declare Function LoadCursor Lib "user32" Alias "LoadCursorA" _ 87 (ByVal hinstance As Long, ByVal lpcursorname As String) As Long 88 89 Public Declare Function RegisterClass Lib "user32" Alias "RegisterClassA" (ByRef Class As WNDCLASS) As Long 90 91 Public Declare Function CreateWindowEx Lib "user32" Alias "CreateWindowExA" _ 92 (ByVal dwexstyle As Long, ByVal lpclassname As String, ByVal lpwindowname As String, _ 93 ByVal dwstyle As Long, ByVal x As Long, ByVal y As Long, ByVal nwidth As Long, _ 94 ByVal nheight As Long, ByVal hwndparent As Long, ByVal hmenu As Long, _ 95 ByVal hinstance As Long, lpparam As Any) As Long 96 97 Public Declare Function CreatePalette Lib "gdi32" (lplogpalette As LOGPALETTE) As Long 98 99 Public Declare Function SelectPalette Lib "gdi32" (ByVal hdc As Long, _ 100 ByVal hpalette As Long, ByVal bforcebackground As Long) As Long 101 102 Public Declare Function RealizePalette Lib "gdi32" (ByVal hdc As Long) As Long 103 104 Public Declare Function SetDIBitsToDevice Lib "gdi32" _ 105 (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal dx As Long, ByVal dy As Long, _ 106 ByVal SrcX As Long, ByVal SrcY As Long, ByVal Scan As Long, ByVal NumScans As Long, _ 107 Bits As Any, BitsInfo As Any, ByVal wusage As Long) As Long 108 109 Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long 110 111 Public Declare Function ReleaseDC Lib "user32" (ByVal hwnd As Long, ByVal hdc As Long) As Long 112 81

113 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 114 ' 115 ' Application data 116 ' 117 Public Const szshowclassname As String = "ShowWndClass" 118 119 Public hswnd As Long ' show window handle 120 Public w_swnd As Long ' width of show window 121 Public h_swnd As Long ' heigth of show window 122 123 Public lpdibheader() As Byte 124 Public lpdibdata() As Byte 125 Public lppollitra As LOGPALETTE 126 Public hpgrayscale As Long 127 128 129 ' 130 ' UpdateImage - updates data and shows the current fingerprint image. 131 ' Argument list: 132 ' srcdata - new fingerprint image. 133 ' 134 Sub UpdateImage(ByVal srcdata As Long) 135 Dim icyc As Long 136 Dim hdc As Long 137 138 ' rotate an image while copying data to the DIB data 139 For icyc = 0 To h_swnd - 1 140 Call CopyMemory(lpDIBData((h_SWnd - icyc - 1) * w_swnd), _ 141 ByVal (srcdata + icyc * w_swnd), w_swnd) 142 Next icyc 143 144 ' show the fingerprint image 145 hdc = GetDC(hSWnd) 146 DIBShow (hdc) 147 Call ReleaseDC(hSWnd, hdc) 148 149 End Sub 150 151 152 ' 153 ' DIBShow - shows the captured fingerprint image. 154 ' Argument list: 155 ' hdc - show window device context. 156 ' 157 Sub DIBShow(ByVal hdc As Long) 158 159 Call SelectPalette(hdc, hpgrayscale, 0) 160 Call RealizePalette(hdc) 161 162 Call SetDIBitsToDevice(hdc, 0, 0, w_swnd, h_swnd, _ 163 0, 0, 0, h_swnd, lpdibdata(0), lpdibheader(0), DIB_RGB_COLORS) 164 165 End Sub 166 167 ' 168 ' PrepareView - allocates memory & initializes data for fingerprint viewing. 169 ' Argument list: 170 ' w, h, d - width, height and color depth of fingerprint image. 171 ' Return value: 172 ' True - success; 173 ' False - error. 174 ' 175 Function PrepareView(w As Long, h As Long, d As Integer) As Boolean 176 177 Dim dib_bminfo As BITMAPINFO 178 Dim dib_bmicolors(255) As RGBQUAD 179 Dim icyc As Long 180 181 ' support the 256-colors DIB only 182 If d <> 8 Then 183 PrepareView = False 184 Exit Function 185 End If 186 187 ' allocate memory for DIB image 188 ReDim lpdibheader(len(dib_bminfo) + Len(dib_BMInfo.bmiColors) * 255) 82

189 ReDim lpdibdata(w * h) 190 191 ' fill the DIB header 192 dib_bminfo.bmiheader.bisize = Len(dib_BMInfo.bmiHeader) 193 dib_bminfo.bmiheader.biwidth = w 194 dib_bminfo.bmiheader.biheight = h 195 dib_bminfo.bmiheader.biplanes = 1 196 dib_bminfo.bmiheader.bibitcount = d 197 dib_bminfo.bmiheader.bicompression = BI_RGB 198 199 ' fill the logical palette 200 lppollitra.palversion = 768 201 lppollitra.palnumentries = 256 202 203 ' initialize logical and DIB palettes to grayscale 204 For icyc = 0 To 255 205 dib_bmicolors(icyc).rgbblue = icyc 206 dib_bmicolors(icyc).rgbgreen = icyc 207 dib_bmicolors(icyc).rgbred = icyc 208 lppollitra.palpalentry(icyc).peblue = icyc 209 lppollitra.palpalentry(icyc).pegreen = icyc 210 lppollitra.palpalentry(icyc).pered = icyc 211 Next icyc 212 213 ' prepare DIB header 214 Call CopyMemory(lpDIBHeader(0), dib_bminfo.bmiheader, _ 215 Len(dib_BMInfo.bmiHeader)) 216 Call CopyMemory(lpDIBHeader(40), dib_bmicolors(0), _ 217 Len(dib_bmiColors(0)) * 256) 218 219 ' create a grayscale palette 220 hpgrayscale = CreatePalette(lpPolLitra) 221 222 PrepareView = True 223 224 End Function 225 226 227 ' 228 ' GetFunAddr - get function address 229 ' 230 Function GetFunAddr(ByVal lngfnptr As Long) As Long 231 GetFunAddr = lngfnptr 232 End Function 233 234 235 ' 236 ' ShowWndProc - view window callback function 237 ' 238 Function ShowWndProc(ByVal hwnd As Long, ByVal msg As Long, ByVal wparam As Long, _ 239 ByVal lparam As Long) As Long 240 Dim hdc As Long 241 Dim ps As PAINTSTRUCT 242 243 Select Case msg 244 Case WM_PAINT 245 hdc = BeginPaint(hwnd, ps) 246 DIBShow (hdc) 247 Call EndPaint(hwnd, ps) 248 Case WM_ERASEBKGND 249 ShowWndProc = 1 250 Exit Function 251 Case WM_DESTROY 252 ShowWndProc = 0 253 Exit Function 254 End Select 255 256 ShowWndProc = DefWindowProc(hwnd, msg, wparam, lparam) 257 258 End Function 259 260 261 ' 262 ' weregshowwnd - register window class for viewing fingerprint image 263 ' Return value: 264 ' 0 - error while register window class 83

265 Function weregshowwnd() As Long 266 Dim Class As WNDCLASS 267 268 Class.style = 0 269 Class.lpfnwndproc = GetFunAddr(AddressOf ShowWndProc) 270 Class.cbClsextra = 0 271 Class.cbWndExtra2 = 0 272 Class.hInstance = VB.App.hInstance 273 Class.hIcon = 0 274 Class.hCursor = 0 275 Class.hbrBackground = COLOR_WINDOWTEXT + 1 276 Class.lpszMenuName = Empty 277 Class.lpszClassName = szshowclassname 278 279 weregshowwnd = RegisterClass(Class) 280 281 End Function 282 283 284 ' 285 ' CreateShowWnd - create window for viewing fingerprint image 286 ' Argument list: 287 ' hparent - parent window; 288 ' x, y - upper left corner in parent; 289 ' w, h - window's width and height. 290 ' Return value: 291 ' 0 - error creating. 292 ' 293 Function CreateShowWnd(ByVal hparent As Long, ByVal x As Long, ByVal y As Long, _ 294 ByVal w As Long, ByVal h As Long) As Long 295 296 ' store show window dimension 297 w_swnd = w 298 h_swnd = h 299 300 ' register window class 301 weregshowwnd 302 303 ' prepare data for view fingerprint image 304 If PrepareView(w, h, 8) = False Then 305 CreateShowWnd = 0 306 Exit Function 307 End If 308 309 ' create show window 310 hswnd = CreateWindowEx(0, szshowclassname, 0&, WS_CHILD + WS_VISIBLE + WS_EX_DLGMODALFRAME, _ 311 x, y, w, h, hparent, 0, VB.App.hInstance, 0&) 312 CreateShowWnd = hswnd 313 If hswnd = 0 Then 314 Exit Function 315 End If 316 UpdateWindow (hparent) 317 318 End Function The modules of Administration Tools and Building Security System MySQLADODB.bas It is used to connect the MySQL database. 1 Public conn As New ADODB.Connection 2 Public strserverip As String 3 4 Public Function opendbcn() 5 6 If conn.state = 1 Then conn.close 7 8 strserverip = getcontent("serverip") 9 10 conn.cursorlocation = aduseclient 11 12 'connect MySQL database server 13 conn.connectionstring = "DRIVER={MySQL ODBC 3.51 Driver};" _ 84

14 & "SERVER=" & strserverip & ";" _ 15 & "DATABASE=ive_fyp;" _ 16 & "UID=ive;" _ 17 & "PWD=ive;" _ 18 & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841 19 conn.open 20 End Function ReadINI.bas It is used to read the config.ini file. It is used for create the area to show fingerprint image. 1 Option Explicit 2 3 Public Const strinfoexcapechr = "#" ' escape character in Info file 4 Public Const intinfolength = 1024 ' Set Info file length 5 6 Public strinfoname(intinfolength) As String ' Info Name 7 Public strinfocontent(intinfolength) As String ' Info Content 8 9 ' Program start function 10 Sub main() 11 Call readinfo(app.path & "\config.ini", False) 12 'MsgBox getcontent("serverip") 13 14 Call opendbcn 15 Select_Mode.Show 16 End Sub 17 18 19 Public Sub readinfo(strinfopath As String, blnreload As Boolean) 20 21 Dim strlinetmp As String 22 Dim lngassignpos As Long 23 Dim idxcnt As Long 24 25 ' Check the Info File var is blank or not 26 If Len(strInfoPath) = 0 Then 27 'MsgBox() 28 Exit Sub 29 End If 30 31 ' to Erase the array or not 32 If blnreload Then 33 Erase strinfoname() 34 Erase strinfocontent() 35 36 strinfoname(0) = "" 37 strinfocontent(0) = "" 38 End If 39 40 ' Open input file "startcd.inf" 41 Open strinfopath For Input As #1 42 43 idxcnt = -1 44 While Not EOF(1) 45 46 Line Input #1, strlinetmp 47 48 Select Case Left$(strLineTmp, 1) 49 Case strinfoexcapechr 50 ' Nothing to Do and go to next line 51 Case Chr(13) 52 ' Nothing to Do and go to next line 53 Case Chr(10) 54 ' Nothing to Do and go to next line 55 Case Else 56 idxcnt = idxcnt + 1 57 58 lngassignpos = InStr(1, strlinetmp, "=") 59 'MsgBox lngassignpos 60 61 strinfoname(idxcnt) = Left(strLineTmp, lngassignpos - 1) 85

62 strinfocontent(idxcnt) = Right(strLineTmp, Len(strLineTmp) - lngassignpos) 63 64 'MsgBox strinfoname(idxcnt) & " - " & strinfocontent(idxcnt) 65 End Select 66 67 Wend 68 69 Close #1 70 71 'MsgBox strlinetmp 72 73 End Sub 74 75 ' Get Information Content string in loaded array with Information Name 76 Public Function getcontent(strinformationname As String) 77 Dim i As Integer 78 Dim strfoundcontent As String 79 80 strfoundcontent = "" 81 For i = LBound(strInfoName) To UBound(strInfoName) 82 83 ' Compare the Information Name 84 If strinfoname(i) = strinformationname Then 85 strfoundcontent = strinfocontent(i) 86 End If 87 88 Next i 89 90 getcontent = strfoundcontent 91 End Function The programming codes of form in Administration Tools frmadmin.frm It is the tools main form. 1 Option Explicit 2 Dim RemotePath As String 3 Dim ComputerName As String 4 Dim FolderName As String 5 Dim PhotoName As String 6 7 Private Sub cmdhadd_click() 8 frmadd.show (vbmodal) 9 End Sub 10 11 Private Sub cmdhdelete_click() 12 Dim inthid As Integer 13 14 inthid = Mid(lvwHHolder.SelectedItem.key, 4, Len(lvwHHolder.SelectedItem.key) - 3) 15 16 If lvwhholder.selecteditem.selected Then 17 If MsgBox("Are you sure delete this householder?", vbexclamation + vbyesno, "Delete Record") = vbyes Then 18 conn.execute "DELETE FROM fyp_tblhouseholder WHERE intholderid = " & inthid & ";" 19 showrecord 20 End If 21 End If 22 End Sub 23 24 Private Sub cmdhedit_click() 25 If SelectedHHID = 0 Then 26 MsgBox "Please select householder to edit.", vbexclamation, "Message" 27 Else 28 frmedit.show (vbmodal) 29 End If 30 End Sub 31 32 Private Sub cmdhhlsearch_click() 33 showrecord 34 End Sub 35 36 Private Sub cmdhrefresh_click() 86

37 'lvwhholder.refresh 38 showrecord 39 End Sub 40 41 Private Sub cmdhsearch_click() 42 lvwhholder.listitems.clear 43 showrecord 44 End Sub 45 46 Private Sub cmdvsearch_click() 47 showrecord 48 End Sub 49 50 Private Sub Form_Load() 51 ComputerName = strserverip 'set computer name 52 FolderName = "userdata\visitor" 'set folder name (optional) 53 RemotePath = "\\" & ComputerName & "\" & FolderName & "\" 'set the remote path to store file 54 55 'close all frame 56 frahholder.visible = False 57 frahholderlog.visible = False 58 fravisitorlog.visible = False 59 60 'set all DTPicker date 61 dtpvselectday.value = Format(Now, "dd/mm/yyyy") 62 dtphhlfrom.value = Format(Now, "dd/mm/yyyy") 63 dtphhlto.value = Format(Now, "dd/mm/yyyy") 64 End Sub 65 66 Private Sub lvwhholder_itemclick(byval Item As MSComctlLib.ListItem) 67 SelectedHHID = Mid(lvwHHolder.SelectedItem.key, 4, Len(lvwHHolder.SelectedItem.key) - 3) 68 End Sub 69 70 Private Sub lvwvisitor_beforelabeledit(cancel As Integer) 71 Cancel = 1 72 End Sub 73 74 Private Sub lvwvisitor_itemclick(byval Item As MSComctlLib.ListItem) 75 Dim intvid As Integer 76 77 intvid = Mid(lvwVisitor.SelectedItem.key, 4, Len(lvwVisitor.SelectedItem.key) - 3) 78 79 Dim rs As ADODB.Recordset 80 81 Set rs = New ADODB.Recordset 82 83 rs.open "SELECT * FROM fyp_tblvisitor WHERE intvisitorid = " & intvid & ";", conn, adopenstatic, adlockreadonly 84 85 imgvphoto.picture = LoadPicture(RemotePath & rs!chrfacedata & ".bmp") 86 End Sub 87 88 Private Sub mnuexit_click() 89 End 90 End Sub 91 92 Private Sub mnuhhdb_click() 93 frahholder.visible = True 94 frahholderlog.visible = False 95 fravisitorlog.visible = False 96 showrecord 97 End Sub 98 99 Private Sub showrecord() 100 Dim rs1 As ADODB.Recordset 101 Dim rs2 As ADODB.Recordset 102 Dim rs3 As ADODB.Recordset 103 104 Dim strphotoname As String 105 Dim strbuilding As String 106 Dim strhname As String 107 Dim strhhlname As String 108 109 Dim datseldate As Date 87

110 Dim datdatefrom As Date 111 Dim datdateto As Date 112 113 Dim inthhid As Integer 114 Dim inthhlid As Integer 115 116 Dim idxvisitor As Long 117 Dim idxhholder As Long 118 Dim idxhhlog As Long 119 120 strbuilding = "%" 121 datseldate = dtpvselectday.value 122 datdatefrom = dtphhlfrom.value 123 datdateto = dtphhlto.value 124 125 If cbobuilding.text <> "All" Then 126 strbuilding = cbobuilding.text 127 'msgbox strbuilding 128 End If 129 130 strhname = "%" 131 If txthhname.text <> "" Then 132 strhname = txthhname.text 133 End If 134 135 inthhid = 0 136 If txthhid.text <> "" Then 137 inthhid = Val(txtHHID.Text) 138 strhname = "" 139 End If 140 141 strhhlname = "" 142 If txthhlname.text <> "" Then 143 strhhlname = txthhlname.text 144 End If 145 146 inthhlid = 0 147 If txthhlid.text <> "" Then 148 inthhlid = Val(txtHHLID.Text) 149 strhhlname = "" 150 End If 151 152 Set rs1 = New ADODB.Recordset 153 rs1.open "SELECT * FROM fyp_tblhouseholder h, fyp_tblbuilding b, fyp_tblfloorflat f " _ 154 & "WHERE (b.intbuildingid = h.intbuildingid AND f.intffid = h.intffid) AND " _ 155 & "(h.intholderid = " & inthhid & " OR " _ 156 & "h.chrholdername LIKE '" & strhname & "') ORDER BY intholderid ASC;", conn, adopenstatic, adlockreadonly 157 158 lvwhholder.listitems.clear 159 idxhholder = 0 160 While Not rs1.eof 161 idxhholder = idxhholder + 1 162 lvwhholder.listitems.add idxhholder, "hid" & rs1("intholderid"), rs1("intholderid") 163 lvwhholder.listitems.item(idxhholder).listsubitems.add 1,, rs1("chrholdername") 164 lvwhholder.listitems.item(idxhholder).listsubitems.add 2,, rs1("chrgender") 165 lvwhholder.listitems.item(idxhholder).listsubitems.add 3,, rs1("datbirth") 166 lvwhholder.listitems.item(idxhholder).listsubitems.add 4,, rs1("chrhkid") 167 lvwhholder.listitems.item(idxhholder).listsubitems.add 5,, rs1("datregdate") 168 lvwhholder.listitems.item(idxhholder).listsubitems.add 6,, rs1("chrbuildingname") 169 lvwhholder.listitems.item(idxhholder).listsubitems.add 7,, rs1("chrfloor") & rs1("chrflat") 170 171 lvwhholder.refresh 172 173 rs1.movenext 174 Wend 175 176 Set rs2 = New ADODB.Recordset 177 rs2.open "SELECT v.intvisitorid, v.datentry, b.chrbuildingname, " _ 178 & "CONCAT(f.chrFloor, f.chrflat) AS 'Flat', v.chrfacedata, v.chrfingerdata " _ 179 & "FROM fyp_tblvisitor v, fyp_tblbuilding b, fyp_tblfloorflat f " _ 180 & "WHERE b.intbuildingid = v.intbuildingid AND f.intffid = v.intffid AND " _ 88

181 & "b.chrbuildingname LIKE '" & strbuilding & "' AND " _ 182 & "(v.datentry >= '" & Format(datSelDate, "yyyy-mm-dd") & " 00:00:00' AND " _ 183 & "v.datentry <= '" & Format(datSelDate, "yyyy-mm-dd") & " 23:59:59');", conn, adopenstatic, adlockreadonly 184 185 lvwvisitor.listitems.clear 186 idxvisitor = 0 187 While Not rs2.eof 188 idxvisitor = idxvisitor + 1 189 lvwvisitor.listitems.add idxvisitor, "vid" & rs2("intvisitorid"), rs2("intvisitorid") 190 lvwvisitor.listitems.item(idxvisitor).listsubitems.add 1,, rs2("datentry") 191 lvwvisitor.listitems.item(idxvisitor).listsubitems.add 2,, rs2("chrbuildingname") 192 lvwvisitor.listitems.item(idxvisitor).listsubitems.add 3,, rs2("flat") 193 194 lvwvisitor.refresh 195 196 rs2.movenext 197 Wend 198 199 Set rs3 = New ADODB.Recordset 200 201 Clipboard.SetText "SELECT * FROM fyp_tblholderlog l, fyp_tblhouseholder h " _ 202 & "WHERE l.intholderid = h.intholderid AND " _ 203 & "(l.intholderid = " & inthhlid & " OR h.chrholdername LIKE '" & strhhlname & "' OR" _ 204 & "(l.datintime >= '" & Format(datDateFrom, "yyyy-mm-dd") & " 00:00:00' AND " _ 205 & "l.datintime <= '" & Format(datDateTo, "yyyy-mm-dd") & " 23:59:59'));" 206 207 rs3.open "SELECT * FROM fyp_tblholderlog l, fyp_tblhouseholder h " _ 208 & "WHERE l.intholderid = h.intholderid AND " _ 209 & "(l.intholderid = " & inthhlid & " OR h.chrholdername LIKE '" & strhhlname & "') AND " _ 210 & "(l.datintime >= '" & Format(datDateFrom, "yyyy-mm-dd") & " 00:00:00' AND " _ 211 & "l.datintime <= '" & Format(datDateTo, "yyyy-mm-dd") & " 23:59:59');", conn, adopenstatic, adlockreadonly 212 213 lvwhhlog.listitems.clear 214 idxhhlog = 0 215 While Not rs3.eof 216 idxhhlog = idxhhlog + 1 217 lvwhhlog.listitems.add idxhhlog, "lid" & rs3("intlogid"), rs3("intholderid") 218 lvwhhlog.listitems.item(idxhhlog).listsubitems.add 1,, rs3("chrholdername") 219 lvwhhlog.listitems.item(idxhhlog).listsubitems.add 2,, rs3("datintime") 220 221 lvwhhlog.refresh 222 223 rs3.movenext 224 Wend 225 End Sub 226 227 Private Sub mnuhhlog_click() 228 frahholderlog.visible = True 229 frahholder.visible = False 230 fravisitorlog.visible = False 231 End Sub 232 233 Private Sub mnuvlog_click() 234 235 fravisitorlog.visible = True 236 frahholder.visible = False 237 frahholderlog.visible = False 238 239 Dim rs As ADODB.Recordset 240 241 Set rs = New ADODB.Recordset 242 rs.open "SELECT * FROM fyp_tblbuilding;", conn, adopenstatic, adlockreadonly 243 244 cbobuilding.clear 245 cbobuilding.additem "All" 246 cbobuilding.text = "All" 247 While Not rs.eof 248 89

249 cbobuilding.additem rs("chrbuildingname") 250 251 rs.movenext 252 253 Wend 254 255 End Sub frmadd.frm It is a form of add new householder. 1 Option Explicit 2 Dim RemotePath As String 3 Dim ComputerName As String 4 Dim FolderName As String 5 Dim AESFilename As String 6 7 Private Sub cmdclose_click() 8 Unload Me 9 End Sub 10 11 Private Sub cmdenroll_click() 12 'start the capture timer 13 tmrstartcap.interval = 3000 14 tmrstartcap.enabled = True 15 End Sub 16 17 Private Sub cmdsave_click() 18 If AESFilename = "" Then 19 MsgBox "Please enroll the face.", vbcritical, "Message" 20 Else 21 AddHHolder 22 End If 23 End Sub 24 25 Private Sub cmdstartcam_click() 26 InitiateCam 27 cmdenroll.enabled = True 28 End Sub 29 30 Private Sub cmdstopcam_click() 31 UninitiateCam 32 cmdenroll.enabled = False 33 End Sub 34 35 Private Sub Form_Load() 36 ComputerName = strserverip 'set computer name 37 FolderName = "userdata\householder" 'set folder name (optional) 38 RemotePath = "\\" & ComputerName & "\" & FolderName & "\" 'set the remote path to store file 39 40 'set the maxlength of all textbox 41 txtname.maxlength = 255 42 txtyear.maxlength = 4 43 txtmonth.maxlength = 2 44 txtday.maxlength = 2 45 txthkid1.maxlength = 2 46 txthkid2.maxlength = 6 47 txthkid3.maxlength = 1 48 49 'reset all combo box 50 cbogender.text = cbogender.list(0) 51 cbobuilding.text = cbobuilding.list(0) 52 cbofloor.text = cbofloor.list(0) 53 cboflat.text = cboflat.list(0) 54 55 cmdenroll.enabled = False 56 tmrstartcap.enabled = False 57 58 'MsgBox "Please enroll the face first.", vbinformation, "Message" 59 60 End Sub 61 62 Private Sub InitiateCam() 90

63 'Initiate the webcam 64 Webcam.SetSizeType 1 65 Webcam.SetEyeThreshold 180000 66 Webcam.SetThreshold 80000 67 Webcam.InitSmartGate 68 Webcam.Show 69 piccammask.visible = False 70 End Sub 71 72 Private Sub UninitiateCam() 73 'Uninitiate the webcam 74 Webcam.Unshow 75 Webcam.UninitSmartGate 76 piccammask.visible = True 77 End Sub 78 79 Private Sub Form_Unload(Cancel As Integer) 80 UninitiateCam 81 End Sub 82 83 Private Sub GenName() 84 Dim AESKey As CRijndael 85 Dim plaintext() As Byte 86 Dim enctext() As Byte 87 Dim encpassword() As Byte 88 Dim lcount As Long 89 Dim llength As Long 90 91 Set AESKey = New CRijndael 'set AESKey from class modules 92 93 plaintext = Format(Now, "yymmddhhmmss") 94 encpassword = "" 'default no password 95 96 enctext = AESKey.EncryptData(plainText, encpassword) 97 AESFilename = "" 98 For lcount = 0 To UBound(encText) 99 AESFilename = AESFilename & Right("0" & Hex(encText(lCount)), 2) 100 Next 101 102 End Sub 103 104 Private Sub tmrstartcap_timer() 105 GenName 'generate the filename to AES format 106 If (Webcam.SaveToBmpImageT(RemotePath & AESFilename & ".bmp", 320, 240)) Then 'save bitmap from camera 107 Webcam.AppendData RemotePath & AESFilename & ".bmp", RemotePath & AESFilename & ".usr" 'save the template file from bitmap 108 MsgBox "Face Enrollment Successful!", vbinformation, "Face Enrollment" 109 Else 110 MsgBox "Face Enrollment Failed!\nPlease try again!", vbcritical, "Face Enrollment" 111 End If 112 113 'stop the timer after 3 seconds 114 If tmrstartcap.interval = 3000 Then 115 tmrstartcap.enabled = False 116 End If 117 End Sub 118 119 Private Sub AddHHolder() 120 Dim rs1 As ADODB.Recordset 121 Dim rs2 As ADODB.Recordset 122 Dim datbirth As Date 123 Dim strhkid As String 124 125 Set rs1 = New ADODB.Recordset 126 rs1.open "SELECT intbuildingid FROM fyp_tblbuilding WHERE chrbuildingname LIKE '" & cbobuilding.text & "';", conn, adopenstatic, adlockreadonly 127 128 Set rs2 = New ADODB.Recordset 129 rs2.open "SELECT intffid FROM fyp_tblfloorflat WHERE chrfloor = '" & cbofloor.text & "' AND chrflat = '" & cboflat.text & "';", conn, adopenstatic, adlockreadonly 130 131 datbirth = txtyear.text & "/" & txtmonth.text & "/" & txtday.text 132 strhkid = UCase(txtHKID1.Text) & txthkid2.text & "(" & txthkid3.text & ")" 133 134 'insert visitor record 91

135 conn.execute "INSERT INTO fyp_tblhouseholder VALUES ('', '" & txtname.text & "', '" & cbogender.text & "', '" & Format(datBirth, "YYYY-MM-DD") & "', '" _ 136 & strhkid & "', '" & Format(Now, "YYYY-MM-DD HH:MM:SS") & "', '" & AESFilename & "', '" & rs1!intbuildingid & "', " & rs2!intffid & ");",, adexecutenorecords 137 138 rs1.close 139 Set rs1 = Nothing 140 141 rs2.close 142 Set rs2 = Nothing 143 144 MsgBox "Success to save the householder in database", vbinformation, "Save New Householder" 145 146 'reset all 147 AESFilename = "" 148 txtname.text = "" 149 txtyear.text = "" 150 txtmonth.text = "" 151 txtday.text = "" 152 txthkid1.text = "" 153 txthkid2.text = "" 154 txthkid3.text = "" 155 156 cbogender.text = cbogender.list(0) 157 cbobuilding.text = cbobuilding.list(0) 158 cbofloor.text = cbofloor.list(0) 159 cboflat.text = cboflat.list(0) 160 161 UninitiateCam 162 cmdenroll.enabled = False 163 164 End Sub frmedit.frm It is a form of edit selected householder. 1 Option Explicit 2 Dim RemotePath As String 3 Dim ComputerName As String 4 Dim FolderName As String 5 Dim AESFilename As String 6 Dim HHID As Integer 7 8 Private Sub cmdclose_click() 9 Unload Me 10 End Sub 11 12 Private Sub cmdenroll_click() 13 'start the capture timer 14 tmrstartcap.interval = 3000 15 tmrstartcap.enabled = True 16 End Sub 17 18 Private Sub cmdsave_click() 19 UpdateHHolder 20 End Sub 21 22 Private Sub cmdstartcam_click() 23 InitiateCam 24 cmdenroll.enabled = True 25 End Sub 26 27 Private Sub cmdstopcam_click() 28 UninitiateCam 29 cmdenroll.enabled = False 30 End Sub 31 32 Private Sub Form_Load() 33 Dim strbirth As String 34 35 ComputerName = strserverip 'set computer name 36 FolderName = "userdata\householder" 'set folder name (optional) 92

37 RemotePath = "\\" & ComputerName & "\" & FolderName & "\" 'set the remote path to store file 38 39 'find the householder id and put data in textbox and combobox 40 HHID = SelectedHHID 41 Dim rs As ADODB.Recordset 42 Set rs = New ADODB.Recordset 43 rs.open "SELECT * FROM fyp_tblhouseholder h, fyp_tblfloorflat f WHERE h.intholderid = " & HHID & " AND f.intffid = h.intffid;", conn, adopenstatic, adlockreadonly 44 45 strbirth = Format(rs!datBirth, "yyyy-mm-dd") 'format the strbirth easy to read 46 AESFilename = rs!chruserdata 47 48 txtname.text = rs!chrholdername 49 txtyear.text = Left(strBirth, 4) 50 txtmonth.text = Mid(strBirth, 6, 2) 51 txtday.text = Right(strBirth, 2) 52 txthkid1.text = Mid(rs!chrHKID, 1, 1) 53 txthkid2.text = Mid(rs!chrHKID, 2, 6) 54 txthkid3.text = Mid(rs!chrHKID, 9, 1) 55 If (rs!chrgender = "M") Then 56 cbogender.text = cbogender.list(0) 57 ElseIf (rs!chrgender = "F") Then 58 cbogender.text = cbogender.list(1) 59 End If 60 cbobuilding.text = cbobuilding.list(val(rs!intbuildingid) - 1) 61 cbofloor.text = cbofloor.list(val(rs!chrfloor) - 1) 62 cboflat.text = cboflat.list(asc(rs!chrflat) - 65) 63 64 'disable some textbox to prevent modify 65 txtname.enabled = False 66 txtyear.enabled = False 67 txtmonth.enabled = False 68 txtday.enabled = False 69 txthkid1.enabled = False 70 txthkid2.enabled = False 71 txthkid3.enabled = False 72 cbogender.enabled = False 73 74 'set the maxlength of all textbox 75 txtname.maxlength = 255 76 txtyear.maxlength = 4 77 txtmonth.maxlength = 2 78 txtday.maxlength = 2 79 txthkid1.maxlength = 2 80 txthkid2.maxlength = 6 81 txthkid3.maxlength = 1 82 83 cmdenroll.enabled = False 84 tmrstartcap.enabled = False 85 86 picholderimage.picture = LoadPicture(RemotePath & rs!chruserdata & ".bmp") 'load the previous enrolled pic 87 88 'MsgBox "Please enroll the face first.", vbinformation, "Message" 89 90 End Sub 91 92 Private Sub InitiateCam() 93 'Initiate the webcam 94 Webcam.SetSizeType 1 95 Webcam.SetEyeThreshold 180000 96 Webcam.SetThreshold 80000 97 Webcam.InitSmartGate 98 Webcam.Show 99 picholderimage.visible = False 100 piccammask.visible = False 101 End Sub 102 103 Private Sub UninitiateCam() 104 'Uninitiate the webcam 105 Webcam.Unshow 106 Webcam.UninitSmartGate 107 piccammask.visible = True 108 End Sub 109 93

110 Private Sub Form_Unload(Cancel As Integer) 111 UninitiateCam 112 End Sub 113 114 Private Sub GenName() 115 Dim AESKey As CRijndael 116 Dim plaintext() As Byte 117 Dim enctext() As Byte 118 Dim encpassword() As Byte 119 Dim lcount As Long 120 Dim llength As Long 121 122 Set AESKey = New CRijndael 'set AESKey from class modules 123 124 plaintext = Format(Now, "yymmddhhmmss") 125 encpassword = "" 'default no password 126 127 enctext = AESKey.EncryptData(plainText, encpassword) 128 AESFilename = "" 129 For lcount = 0 To UBound(encText) 130 AESFilename = AESFilename & Right("0" & Hex(encText(lCount)), 2) 131 Next 132 133 End Sub 134 135 Private Sub tmrstartcap_timer() 136 GenName 'generate the filename to AES format 137 If (Webcam.SaveToBmpImageT(RemotePath & AESFilename & ".bmp", 320, 240)) Then 'save bitmap from camera 138 Webcam.AppendData RemotePath & AESFilename & ".bmp", RemotePath & AESFilename & ".usr" 'save the template file from bitmap 139 MsgBox "Face Enrollment Successful!", vbinformation, "Face Enrollment" 140 Else 141 MsgBox "Face Enrollment Failed!\nPlease try again!", vbcritical, "Face Enrollment" 142 End If 143 144 'stop the timer after 3 seconds 145 If tmrstartcap.interval = 3000 Then 146 tmrstartcap.enabled = False 147 End If 148 End Sub 149 150 Private Sub UpdateHHolder() 151 Dim rs1 As ADODB.Recordset 152 Dim rs2 As ADODB.Recordset 153 154 Set rs1 = New ADODB.Recordset 155 rs1.open "SELECT intbuildingid FROM fyp_tblbuilding WHERE chrbuildingname LIKE '" & cbobuilding.text & "';", conn, adopenstatic, adlockreadonly 156 157 Set rs2 = New ADODB.Recordset 158 rs2.open "SELECT intffid FROM fyp_tblfloorflat WHERE chrfloor = '" & cbofloor.text & "' AND chrflat = '" & cboflat.text & "';", conn, adopenstatic, adlockreadonly 159 160 conn.execute "UPDATE fyp_tblhouseholder SET datregdate = '" & Format(Now, "YYYY-MM-DD") & "', intbuildingid = " & rs1!intbuildingid & _ 161 ", intffid = " & rs2!intffid & ", chruserdata = '" & AESFilename & "' WHERE intholderid = " & HHID & ";" 162 163 rs1.close 164 Set rs1 = Nothing 165 166 rs2.close 167 Set rs2 = Nothing 168 169 MsgBox "Successful update householder detail in database.", vbinformation, "Update Householder" 170 171 End Sub 172 173 174 Private Sub AddHHolder() 175 Dim rs1 As ADODB.Recordset 176 Dim rs2 As ADODB.Recordset 177 Dim datbirth As Date 178 Dim strhkid As String 94

179 180 Set rs1 = New ADODB.Recordset 181 rs1.open "SELECT intbuildingid FROM fyp_tblbuilding WHERE chrbuildingname LIKE '" & cbobuilding.text & "';", conn, adopenstatic, adlockreadonly 182 183 Set rs2 = New ADODB.Recordset 184 rs2.open "SELECT intffid FROM fyp_tblfloorflat WHERE chrfloor = '" & cbofloor.text & "' AND chrflat = '" & cboflat.text & "';", conn, adopenstatic, adlockreadonly 185 186 datbirth = txtyear.text & "/" & txtmonth.text & "/" & txtday.text 187 strhkid = UCase(txtHKID1.Text) & txthkid2.text & "(" & txthkid3.text & ")" 188 189 'insert visitor record 190 conn.execute "INSERT INTO fyp_tblhouseholder VALUES ('', '" & txtname.text & "', '" & cbogender.text & "', '" & Format(datBirth, "YYYY-MM-DD") & "', '" _ 191 & strhkid & "', '" & Format(Now, "YYYY-MM-DD HH:MM:SS") & "', '" & AESFilename & "', '" & rs1!intbuildingid & "', " & rs2!intffid & ");",, adexecutenorecords 192 193 rs1.close 194 Set rs1 = Nothing 195 196 rs2.close 197 Set rs2 = Nothing 198 199 MsgBox "Success to save the householder in database.", vbinformation, "Save New Householder" 200 201 'reset all 202 AESFilename = "" 203 txtname.text = "" 204 txtyear.text = "" 205 txtmonth.text = "" 206 txtday.text = "" 207 txthkid1.text = "" 208 txthkid2.text = "" 209 txthkid3.text = "" 210 211 cbogender.text = cbogender.list(0) 212 cbobuilding.text = cbobuilding.list(0) 213 cbofloor.text = cbofloor.list(0) 214 cboflat.text = cboflat.list(0) 215 216 UninitiateCam 217 cmdenroll.enabled = False 218 219 End Sub The programming codes of form in Building Security System Select_Mode.frm It is the mode selection form. 1 Private Sub btnclose_click() 2 End 3 End Sub 4 5 Private Sub Form_Load() 6 mode.movie = App.path & "\interface\select.swf" 7 mode.play 8 9 End Sub 10 11 Private Sub mode_fscommand(byval command As String, ByVal args As String) 12 Select Case command 13 Case "householder" 14 H_Mode.Show 15 Case "visitor" 16 V_Mode.Show 17 End Select 18 End Sub 95

H_Mode.frm It is householder mode form. 1 Option Explicit 2 Dim RemotePath As String 3 Dim ComputerName As String 4 Dim FolderName As String 5 6 Private Sub Form_Load() 7 ComputerName = strserverip 'set computer name 8 FolderName = "userdata\householder" 'set folder name (optional) 9 RemotePath = "\\" & ComputerName & "\" & FolderName & "\" 'set the remote path to store file 10 11 'set the filename of flash and play 12 Interface.Movie = App.path & "\interface\householder.swf" 13 Interface.Play 14 15 Webcam.Visible = False 16 17 End Sub 18 19 Private Sub Form_Unload(Cancel As Integer) 20 'Unshow and Uninitate the webcam 21 UninitiateCam 22 End Sub 23 24 Private Sub StartCam_Timer() 25 Webcam.Visible = True 26 27 'stop the timer after 2 seconds 28 If StartCam.Interval = 2000 Then 29 StartCam.Enabled = False 30 31 'start the capture timer 32 StartCap.Interval = 3000 33 StartCap.Enabled = True 34 End If 35 End Sub 36 37 Private Sub StartCap_Timer() 38 SearchUser 39 40 End Sub 41 42 Private Sub InitiateCam() 43 'Initiate the webcam 44 Webcam.SetSizeType 1 45 Webcam.SetEyeThreshold 180000 46 Webcam.SetThreshold 80000 47 Webcam.InitSmartGate 48 Webcam.Show 49 Webcam.Visible = True 50 51 End Sub 52 53 Private Sub UninitiateCam() 54 'Uninitiate the webcam 55 Webcam.Visible = False 56 Webcam.Unshow 57 Webcam.UninitSmartGate 58 End Sub 59 60 Private Sub SearchUser() 61 Dim rs As ADODB.Recordset 62 Dim success As Boolean 63 Dim aaa As String 64 65 success = False 66 67 Set rs = New ADODB.Recordset 68 rs.open "SELECT intholderid, chrholdername, chruserdata FROM fyp_tblhouseholder;", conn, adopenstatic, adlockreadonly 69 70 Do Until rs.eof Or success = True 96

71 If Webcam.LoadUserData(RemotePath & rs!chruserdata & ".usr", 1) And Webcam.Verify() Then 72 'save log of householder in table "fyp_tblholderlog" 73 conn.execute "INSERT INTO fyp_tblholderlog VALUES ('', '" & rs!intholderid & "', '" & Format(Now, "YYYY-MM-DD HH:MM:SS") & "');",, adexecutenorecords 74 75 success = True 76 77 'show successful message box 78 Interface.SetVariable "VBCommand", "identifysuccess" 79 Interface.SetVariable "Username", rs!chrholdername 80 81 'uninitiate the cam when success 82 StartCap.Enabled = False 83 UninitiateCam 84 Else 85 rs.movenext 86 End If 87 Loop 88 89 'show failed message box when cannot verify 90 If (success = False) Then 91 92 Interface.SetVariable "VBCommand", "identifyfailed" 93 94 'start the capture timer 95 StartCap.Interval = 3000 96 StartCap.Enabled = True 97 End If 98 99 rs.close 100 Set rs = Nothing 101 102 End Sub 103 104 Private Sub Interface_FSCommand(ByVal command As String, ByVal args As String) 105 Select Case command 106 Case "opencam" 107 InitiateCam 108 'start the capture timer 109 StartCap.Interval = 3000 110 StartCap.Enabled = True 111 Case "closecam" 112 UninitiateCam 113 Case "unload" 114 UnloadForm.Interval = 1000 115 UnloadForm.Enabled = True 116 End Select 117 End Sub 118 119 Private Sub UnloadForm_Timer() 120 Interface.Stop 121 Unload Me 122 End Sub V_Mode.frm It is visitor mode form. 1 Option Explicit 2 Dim AESFilename As String 3 Dim FaceName As String 4 Dim FingerName As String 5 Dim RemotePath As String 6 Dim ComputerName As String 7 Dim FolderName As String 8 Dim strfloor As String 9 Dim strflat As String 10 11 Private Sub Enroll_Click() 12 GenName 'generate the filename to AES format 13 Webcam.SaveToBmpImageT RemotePath & AESFilename & ".bmp", 320, 240 'save bitmap from camera 14 Webcam.AppendData RemotePath & AESFilename & ".bmp", RemotePath & AESFilename & ".usr" 'save the template file from bitmap 97

15 16 'Insert visitor record in database 17 AddVisitor 18 19 End Sub 20 21 Private Sub Form_Load() 22 ComputerName = strserverip 'set computer name 23 FolderName = "userdata\visitor" 'set folder name (optional) 24 RemotePath = "\\" & ComputerName & "\" & FolderName & "\" 'set the remote path to store file 25 26 'set the filename of flash and play 27 Interface.Movie = App.path & "\interface\visitor.swf" 28 Interface.Play 29 30 Webcam.Visible = False 31 32 FingerImage.Visible = False 33 End Sub 34 35 Private Sub Form_Unload(Cancel As Integer) 36 'Unshow and Uninitate the webcam 37 UninitiateCam 38 'uninitiate the fingerprint device 39 UninitFinger 40 End Sub 41 42 Private Sub StartFace_Timer() 43 GenName 'generate the filename to AES format 44 FaceName = AESFilename 'put the generated filename in FaceName 45 46 If (Webcam.SaveToBmpImageT(RemotePath & FaceName & ".bmp", 320, 240) = True) Then 'save bitmap from camera 47 Webcam.AppendData RemotePath & FaceName & ".bmp", RemotePath & FaceName & ".usr" 'save the template file from bitmap 48 UninitiateCam 'close the cam 49 Interface.SetVariable "VBCommand", "gotofinger" 'pass the value to flash and run the function 50 End If 51 'stop the timer after 3 seconds 52 If StartFace.Interval = 3000 Then 53 StartFace.Enabled = False 54 End If 55 End Sub 56 57 Private Sub GenName() 58 Dim AESKey As CRijndael 59 Dim plaintext() As Byte 60 Dim enctext() As Byte 61 Dim encpassword() As Byte 62 Dim lcount As Long 63 Dim llength As Long 64 65 Set AESKey = New CRijndael 'set AESKey from class modules 66 67 plaintext = Format(Now, "yymmddhhmmss") 68 encpassword = "" 'default no password 69 70 enctext = AESKey.EncryptData(plainText, encpassword) 71 AESFilename = "" 72 For lcount = 0 To UBound(encText) 73 AESFilename = AESFilename & Right("0" & Hex(encText(lCount)), 2) 74 Next 75 76 End Sub 77 78 Private Sub AddVisitor() 79 Dim rs As ADODB.Recordset 80 81 conn.cursorlocation = aduseclient 82 83 Set rs = New ADODB.Recordset 84 rs.open "SELECT intffid FROM fyp_tblfloorflat WHERE chrfloor = '" & strfloor & "' AND chrflat = '" & strflat & "';", conn, adopenstatic, adlockreadonly 85 98

86 'insert visitor record 87 conn.execute "INSERT INTO fyp_tblvisitor VALUES ('', '" & FaceName & "', '" & FingerName & "', '" & Format(Now, "YYYY-MM-DD HH:MM:SS") & "', 1, " & rs!intffid & ");",, adexecutenorecords 88 89 rs.close 90 Set rs = Nothing 91 92 End Sub 93 94 Private Sub InitiateCam() 95 'Initiate the webcam 96 Webcam.SetSizeType 1 97 Webcam.SetEyeThreshold 180000 98 Webcam.SetThreshold 80000 99 Webcam.InitSmartGate 100 Webcam.Show 101 Webcam.Visible = True 102 End Sub 103 104 Private Sub UninitiateCam() 105 'Uninitiate the webcam 106 Webcam.Visible = False 107 Webcam.Unshow 108 Webcam.UninitSmartGate 109 End Sub 110 111 Private Sub Interface_FSCommand(ByVal command As String, ByVal args As String) 112 Select Case command 113 Case "floorflat" 114 strfloor = Left$(args, Len(args) - 1) 115 strflat = Right$(args, 1) 116 Case "opencam" 117 InitiateCam 118 Case "startface" 119 StartFace.Interval = 3000 120 StartFace.Enabled = True 121 Case "startfinger" 122 InitFinger 123 Case "endfinger" 124 FingerImage.Visible = False 125 Case "unload" 126 UnloadForm.Interval = 1000 127 UnloadForm.Enabled = True 128 End Select 129 End Sub 130 131 Private Sub InitFinger() 132 Dim TemplateSize As Long 133 Dim lptemplatebytes() As Byte 134 Dim template As FTR_DATA 135 136 FingerImage.Visible = True 137 138 'initialize Futronic fingerprint SDK 139 FTRInitialize 140 141 'set dsdk settings: 142 'frame source 143 Dim value As Long 144 value = FSD_FUTRONIC_USB 145 FTRSetParam FTR_PARAM_CB_FRAME_SOURCE, value 146 147 'user's calbacks 148 FTRSetParam FTR_PARAM_CB_CONTROL, AddressOf cbcontrol 149 150 'FAR setting 151 value = 110000 'default threshold setting 152 FTRSetParam FTR_PARAM_MAX_FAR_REQUESTED, value 153 154 'Max Models 155 value = 3 'set the number of times to scan 156 FTRSetParam FTR_PARAM_MAX_MODELS, value 157 158 'create the image area for fingerprint bitmap 159 Dim hswnd As Long 99

160 hswnd = CreateShowWnd(V_Mode.hwnd, 460, 100, 320, 400) 161 162 ' prepare memory for template store 163 FTRGetParam FTR_PARAM_MAX_TEMPLATE_SIZE, TemplateSize 164 165 ReDim lptemplatebytes(0 To TemplateSize - 1) 166 167 ' prepare arguments 168 template.pdata = VarPtr(lpTemplateBytes(0)) 169 170 ' enroll operation 171 FTREnroll 0&, FTR_PURPOSE_ENROLL, template 172 173 'generate the filename 174 GenName 175 FingerName = AESFilename 176 177 ' write template to file 178 If (AddFinger(template.pData, template.dwsize, RemotePath, FingerName)) Then 179 UninitFinger 'uninitiate the fingerprint device 180 End If 181 182 'finally, insert visitor record in database 183 AddVisitor 184 185 'call flash play movie when the finger success. 186 Interface.SetVariable "VBCommand", "succfinger" 187 End Sub 188 189 Private Sub UninitFinger() 190 'uninitialize Futronic fingerprint SDK 191 FTRTerminate 192 End Sub 193 194 Private Sub UnloadForm_Timer() 195 Interface.Stop 196 Unload Me 197 End Sub Programming code of Clubhouse system Clubhouse login system: Project1, Form2 1 Private Sub SearchUser() 2 Dim conn As ADODB.Connection 3 Dim success As Boolean 4 Dim tmp As Integer 5 Dim bbq1 As ADODB.Recordset 6 Dim bbq2 As ADODB.Recordset 7 8 success = False 9 10 Set conn = New ADODB.Connection 11 conn.cursorlocation = aduseclient 12 13 'connect MySQL database server 14 15 conn.connectionstring = "DRIVER={MySQL ODBC 3.51 Driver};" _ 16 & "SERVER=127.0.0.1;" _ 17 & "DATABASE=ive_fyp;" _ 18 & "UID=ive;" _ 19 & "PWD=ive;" _ 20 & "OPTION=" & 1 + 2 + 8 + 32 + 2048 + 163841 21 conn.open 22 23 Set bbq1 = New ADODB.Recordset 24 bbq1.open "SELECT intholderid, chrholdername, chruserdata FROM fyp_tblhouseholder;", conn 25 Set bbq2 = New ADODB.Recordset 26 bbq2.open "SELECT intholderid, datintime FROM fyp_tblclub where fyp_tblclub.intholderid = '" & bbq1!intholderid & "' ;", conn 27 28 Do Until bbq1.eof Or success = True 29 If Webcam.LoadUserData(RemotePath & bbq1!chruserdata & ".usr", 1) And Webcam.Verify() Then 100

30 success = True 31 32 Text1.Text = bbq2!datintime 33 34 Timetake.Visible = True 35 Timetake.Text = "Your Logout time is" 36 37 Text2.Text = Time 38 39 Text3.Text = "See you! " + bbq1!chrholdername + "! Logout successful!" 40 41 conn.execute "UPDATE fyp_tblclub SET datouttime = '" & Format(Now, "HH:MM:SS") & "' WHERE fyp_tblclub.intholderid = '" & bbq1!intholderid & "' ;" 42 43 Command1.Enabled = True 44 Else 45 bbq1.movenext 46 End If 47 Loop 48 49 If (success = False) Then 50 Text3.Text = "Sorry, Logout Failed! Please try again!" 51 End If 52 bbq1.close 53 Set bbq1 = Nothing 54 End Sub 101