Convert Fingerprint from DB to array of bytes

User dfeb81947d

29-07-2004 14:51:07

Hello,





Is there a way to convert all the Integer composing the Fingerprint from a DataBase to the value in byte[]?


For example using the Query:


Select CD_FP1, CD_FP2, ...., CD_FP32 FROM STRUCTURE;


And use a loop to get all the CD_FPx into an array of integer and construct the array of byte from the array of Integer?


Code:
rs = pstmt.executeQuery(query);


int[] tab = new int[32];


if (rs.next()) {


   for (int i=0;i<32;i++) {


      tab[i] = rs.getInt(i+1));


   }


   // here the method to convert fingerprint in int[] into fingerprint in byte[]


}





do I need to use chemaxon.descriptors.ChemicalFingerprint?





Thank you very much.

ChemAxon 9c0afc9aaf

29-07-2004 19:19:34

Hi Jacques,





You can call the following static method:





chemaxon.jchem.db.FingerprintHandler.getFingerprintInBytes(int[] ints)





It returns the appropriate byte[] object.





(This class is not listed in the API, probably because nobody needed it so far.)

User dfeb81947d

30-07-2004 13:33:03

Hi Szilard,





Thank you very much, it was exactly what I was looking for.


Thank you for your help.





Best Regards,

ChemAxon 587f88acea

01-10-2005 15:55:59

hi,


can anyone help me how to convert a fingerprint to hashcode.


I am trying to generate keys from fingerprint.Any suggestion?


Thanks,


Ganesh

ChemAxon 9c0afc9aaf

03-10-2005 09:34:51

Hi Ganesh,





You can generate hash code from fingerprints by adding each column to the hash code and multiplying the hash code with a prime after each addition.


Example:





Code:



        int[] fp=...;  // the fingerprint


        int hashCode=0;


        for (int x=0; x<fp.length; x++) {


            hashCode+=fp[x];


            hashCode*=7919;


        }








Identical molecules will have the same hash code, but molecules with identical hash code will not be always identical of course (but with a high probability).


So hash code can only be used as a pre-filter for checking duplicates.





By the way since JChem 3.0 the structure tables have a column called cd_hash.


This column contains a more efficient (more selective) hash code.


We also provide API access for the generation of this type of hash code:





http://www.chemaxon.com/jchem/doc/api/chemaxon/sss/screen/HashCode.html





Best regards,





Szilard





PS: next time please start a new thread for a new question.

User dfeb81947d

03-10-2005 12:13:43

Dear Szilard,





the last question gives me an other one: How could I construct a Molecule object from a byte[] fingerprint or a int[] fingerprint.


There are methods from MolHandler to get fingerprint either in array of bytes or in array of int, is there the reverse method to construct a molecule from the fingerprint?





Thank you very much


Kind Regards


Jacques

ChemAxon 9c0afc9aaf

03-10-2005 12:29:50

Dear Jacques,





One cannot construct a Molecule object from the fingerprint.


The fingerprint does not contain the necessary information for this, so this is not possible.





You can read more about the fingerprints at the following location:


http://www.chemaxon.com/jchem/doc/user/fingerprint.html








Best regards,





Szilard

User dfeb81947d

04-10-2005 11:35:06

Dear Szilard,


Thank you very much for the precision.





Warmest Regards,


Jacques

ChemAxon 587f88acea

19-11-2005 08:32:56

Hi Szilard,





Thanks for your reply. I will try the sample code you have provided.


Actually i am trying to generate public and private keys from a fingerprint image(may be a jpeg/bmp file)...can you give me some idea how to proceed?





Thanks,


Ganesh


ganeshpindia _at_ gmail.com

ChemAxon 9c0afc9aaf

20-11-2005 13:32:24

Hi Ganesh,
Quote:
Actually i am trying to generate public and private keys from a fingerprint image(may be a jpeg/bmp file)...can you give me some idea how to proceed?
I do not understand your idea.


What would it be used for and how should it work ?





Best regards,





Szilard





PS: if you register in the forum, you can get instant notifications about the answers for your questions.

User 57c0e32442

21-11-2005 04:52:39

Hi slizard,


sorry if i didn't provide enough information.


Normally we can generate public and private keys for a string input.


In the same way can we generate keys for a fingerprint?


My project is to generate keys from a fingerprint.(It's a biometric authentication project)





Thanks,


Ganesh

ChemAxon 9c0afc9aaf

21-11-2005 14:44:48

Dear Ganesh,





The mentioned features (creating private and public keys, biometric authentication) are not covered by ChemAxon's line of products, so I'm afraid I cannot help you with this.





Of course we are still glad to answer any questions directly related to our products.








Best regards,





Szilard