keyme-fingerprint 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/ext/fingerprint/compare/compare.cpp +58 -0
- data/ext/fingerprint/compare/compare.h +31 -0
- data/ext/fingerprint/extconf.rb +13 -0
- data/ext/fingerprint/fingerprint.cpp +51 -0
- metadata +62 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MDY2NjI1MDYzZjQwMjZlM2M2ZjE1NGJhNWFlMjFmZjY1MzQ3Y2E2Nw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
M2IyMDI0ZGFmMjExMDU3NjE5NjNmMWIzMDFjMmMyZDI2NGQ3OGFhZA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
OGU3YTA3MmNmYWI0NzU5MzhhZmNmNGU1NDQ4YjYyMjA3MWQ1NzIxOTUzNDFi
|
10
|
+
Mzg4NDA3NDZlNGQ0ZDk3ODYzYTQwMTQ2OGVkYTgxMWI2M2U3MzMwYmJhZGRk
|
11
|
+
ZmNiYzk0NWVkY2Q5ZDBkZGQxYjVkMDg4ZjI3MTI3OGM5OTdiMTI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YzgzNjIzNTQ3MjkzODJlYzJiZmM0MmVhOWM3YjBjYmU2YmRiOTRiODJkYTk0
|
14
|
+
YmJhODU2N2Y4MzUzZDk2NDkxYTk2MzJkMTM2ZDRiNDI4YTdkMGM0YWU3N2Nj
|
15
|
+
YmQzM2EyMjU0NGIzNzZhNGIyMzRmMjYyZmZhMWY2ODE1NTUwMWQ=
|
@@ -0,0 +1,58 @@
|
|
1
|
+
#include <iostream>
|
2
|
+
#include <fstream>
|
3
|
+
#include <unistd.h>
|
4
|
+
#include "compare.h"
|
5
|
+
|
6
|
+
using namespace std;
|
7
|
+
|
8
|
+
bool VerifyUser( std::string db_file,
|
9
|
+
std::string print_file) {
|
10
|
+
unsigned char *dbFmd = NULL, *printFmd = NULL;
|
11
|
+
unsigned int dbFmdSize = 0, printFmdSize = 0;
|
12
|
+
|
13
|
+
LoadPrint(db_file, &dbFmd, &dbFmdSize);
|
14
|
+
LoadPrint(print_file, &printFmd, &printFmdSize);
|
15
|
+
|
16
|
+
return VerifyUser(dbFmd, dbFmdSize, printFmd, printFmdSize);
|
17
|
+
}
|
18
|
+
|
19
|
+
bool VerifyUser( unsigned char* dbPrint,
|
20
|
+
unsigned int dbPrintSize,
|
21
|
+
unsigned char* print,
|
22
|
+
unsigned int printSize) {
|
23
|
+
|
24
|
+
// Only compare if both fingerprints have data
|
25
|
+
if(dbPrintSize > 0 && printSize > 0) {
|
26
|
+
unsigned int falsematch_rate;
|
27
|
+
int result = dpfj_compare(DPFJ_FMD_ANSI_378_2004, dbPrint, dbPrintSize, 0,
|
28
|
+
DPFJ_FMD_ANSI_378_2004, print, printSize, 0, &falsematch_rate);
|
29
|
+
|
30
|
+
// If the comparison was successful and the prints matched
|
31
|
+
if(result == DPFJ_SUCCESS && falsematch_rate < TARGET_FALSEMATCH_RATE) {
|
32
|
+
return true;
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
return false;
|
37
|
+
}
|
38
|
+
|
39
|
+
void LoadPrint( std::string file,
|
40
|
+
unsigned char** print,
|
41
|
+
unsigned int* printSize) {
|
42
|
+
|
43
|
+
// Open the file in binary mode
|
44
|
+
ifstream input(file.c_str(), ios::in | ios::binary | ios::ate);
|
45
|
+
|
46
|
+
// Only try if the file exists
|
47
|
+
if(input.is_open()) {
|
48
|
+
// Figure out the file size and allocate memory
|
49
|
+
// for the data
|
50
|
+
*printSize = (unsigned int) input.tellg();
|
51
|
+
*print = new unsigned char[*printSize];
|
52
|
+
|
53
|
+
// Read the file data from the beginning
|
54
|
+
input.seekg(0, ios::beg);
|
55
|
+
input.read((char*) (*print), *printSize);
|
56
|
+
input.close();
|
57
|
+
}
|
58
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/*
|
2
|
+
* Provides methods needed to compare fingerprints.
|
3
|
+
*/
|
4
|
+
|
5
|
+
#ifndef COMPARE_H_
|
6
|
+
#define COMPARE_H_
|
7
|
+
|
8
|
+
#include <string>
|
9
|
+
#include <dpfj.h>
|
10
|
+
#include <dpfpdd.h>
|
11
|
+
|
12
|
+
// Target accuracy of fingerprint comparison
|
13
|
+
#define TARGET_FALSEMATCH_RATE (DPFJ_PROBABILITY_ONE / 100000)
|
14
|
+
|
15
|
+
// Compares the fingerprints in the two provided files
|
16
|
+
bool VerifyUser( std::string db_file,
|
17
|
+
std::string print_file);
|
18
|
+
|
19
|
+
// Compares the fingerprints in the two provided buffers
|
20
|
+
bool VerifyUser( unsigned char* dbPrint,
|
21
|
+
unsigned int dbPrintSize,
|
22
|
+
unsigned char* print,
|
23
|
+
unsigned int printSize);
|
24
|
+
|
25
|
+
// Loads a fingerprint from the specified file into the
|
26
|
+
// supplied buffer
|
27
|
+
void LoadPrint( std::string file,
|
28
|
+
unsigned char** print,
|
29
|
+
unsigned int* printSize);
|
30
|
+
|
31
|
+
#endif /*COMPARE_H_*/
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'mkmf-rice'
|
2
|
+
|
3
|
+
$CPPFLAGS += ' -std=c++0x'
|
4
|
+
$INCFLAGS += " -I/opt/DigitalPersona/UareUSDK/Include"
|
5
|
+
|
6
|
+
dir_config('', 'compare', 'compare')
|
7
|
+
|
8
|
+
have_library('dpfj')
|
9
|
+
have_library('dpfpdd')
|
10
|
+
|
11
|
+
$objs = ['fingerprint.o', 'compare/compare.o']
|
12
|
+
|
13
|
+
create_makefile('keyme/fingerprint')
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#include <stdio.h>
|
2
|
+
#include <string>
|
3
|
+
|
4
|
+
#include "compare.h"
|
5
|
+
|
6
|
+
#include "rice/Array.hpp"
|
7
|
+
#include "rice/Module.hpp"
|
8
|
+
|
9
|
+
bool VerifyUserWrapper(Rice::Array _db, Rice::Array _print) {
|
10
|
+
unsigned char *db, *print;
|
11
|
+
db = (unsigned char*) malloc(_db.size());
|
12
|
+
print = (unsigned char *) malloc(_print.size());
|
13
|
+
|
14
|
+
if(!db || !print) return false;
|
15
|
+
|
16
|
+
for(unsigned int i = 0; i < _db.size(); i++) {
|
17
|
+
db[i] = from_ruby<unsigned char>(_db[i]);
|
18
|
+
}
|
19
|
+
for(unsigned int i = 0; i < _print.size(); i++) {
|
20
|
+
print[i] = from_ruby<unsigned char>(_print[i]);
|
21
|
+
}
|
22
|
+
|
23
|
+
bool result = VerifyUser(db, _db.size(), print, _print.size());
|
24
|
+
|
25
|
+
free(db);
|
26
|
+
free(print);
|
27
|
+
|
28
|
+
return result;
|
29
|
+
}
|
30
|
+
|
31
|
+
Rice::Object LoadPrintWrapper(std::string file) {
|
32
|
+
unsigned char *print;
|
33
|
+
unsigned int printSize;
|
34
|
+
|
35
|
+
LoadPrint(file, &print, &printSize);
|
36
|
+
|
37
|
+
Rice::Array result;
|
38
|
+
for(unsigned int i = 0; i < printSize; i++) {
|
39
|
+
result.push(print[i]);
|
40
|
+
}
|
41
|
+
return result;
|
42
|
+
}
|
43
|
+
|
44
|
+
extern "C"
|
45
|
+
void Init_fingerprint() {
|
46
|
+
Rice::Module rb_mKeyMe = Rice::define_module("KeyMe");
|
47
|
+
|
48
|
+
Rice::Module rb_mFingerprint = rb_mKeyMe.define_module("Fingerprint")
|
49
|
+
.define_singleton_method("verify_user", &VerifyUserWrapper)
|
50
|
+
.define_singleton_method("load_print", &LoadPrintWrapper);
|
51
|
+
}
|
metadata
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: keyme-fingerprint
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zachary Salzbank
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-05-04 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: keyme-rice
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.5.1.keyme
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.5.1.keyme
|
27
|
+
description: Load and verify fingerprints scanned using a U.are.U fingerprint scanner.
|
28
|
+
email: zach@keyme.net
|
29
|
+
executables: []
|
30
|
+
extensions:
|
31
|
+
- ext/fingerprint/extconf.rb
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ext/fingerprint/fingerprint.cpp
|
35
|
+
- ext/fingerprint/extconf.rb
|
36
|
+
- ext/fingerprint/compare/compare.cpp
|
37
|
+
- ext/fingerprint/compare/compare.h
|
38
|
+
homepage: http://github.com/keyme/fingerprint-ruby
|
39
|
+
licenses: []
|
40
|
+
metadata: {}
|
41
|
+
post_install_message:
|
42
|
+
rdoc_options: []
|
43
|
+
require_paths:
|
44
|
+
- lib
|
45
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
requirements:
|
56
|
+
- Drivers installed from https://github.com/keyme/fingerprint-drivers
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 2.0.3
|
59
|
+
signing_key:
|
60
|
+
specification_version: 4
|
61
|
+
summary: U.are.U fingerprint scanner methods.
|
62
|
+
test_files: []
|