>something like:
> Signature dsa = Signature.getInstance("SHA/DSA");
> PrivateKey priv = pair.getPrivate();
>
> dsa.initSign(priv);
He just needs a digest, not a digitally signed digest, doesn't he?
See http://mindprod.com/jgloss/digest.html
http://mindprod.com/jgloss/md5.html
http://mindprod.com/jgloss/sha1.html
http://mindprod.com/jgloss/adler.html
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* Test MD5 digest computation
*
* @author Roedy Green
* @version 1.0
* @since 2004-06-07
*/
public class MD5
{
/**
* test MD5 digest, requires Java 1.4+
*
* @param args not used
*/
public static void main ( String[] args ) throws
UnsupportedEncodingException, NoSuchAlgorithmException
{
byte[] theTextToDigestAsBytes = "The quick brown fox jumped over
the lazy dog's back".getBytes( "8859_1" /* encoding */ );
MessageDigest md = MessageDigest.getInstance( "MD5" );
md.update( theTextToDigestAsBytes );
byte[] digest = md.digest();
System.out.println( digest.length );
// 16 bytes, 128 bits long
}
}
.
I think Adler should suffice. It is quick and generates 32 bits, all
you need for a hashCode.
// generate an 32-bit Adler checksum/digest
import java.io.UnsupportedEncodingException;
import java.util.zip.Adler32;
public class Adler
{
/**
* test Adler digest
* @param args not used
*/
public static void main ( String[] args ) throws
UnsupportedEncodingException
{
byte[] theTextToDigestAsBytes = "The quick brown fox jumped over
the lazy dog's back".getBytes( "8859_1" /* encoding */ );
Adler32 digester = new Adler32();
digester.update( theTextToDigestAsBytes );
// getValue produces a long to conform to the Checksum
interface.
// Actual result is 32 bits long not 64!
int digest = (int) digester.getValue();
System.out.println( Integer.toHexString( digest ) );
}
}

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
pvs - 21 Oct 2005 05:25 GMT
Hi all,
Thank you very much for your reply's.
I tried the code you have written here.it is generating some key from
the text but my problem is....it should take fingerprint image as input
and from that we have to generate keys.
I am sorry if i am giving trouble.I told you that i am not a good
programmer.please help me how to proceed.
Can we give fingerprint image as input instead of the text in your
code? i mean with the same or similar code can we generate for the
fingerprint image?
Thanks,
PVS
Roedy Green - 21 Oct 2005 08:25 GMT
>Can we give fingerprint image as input instead of the text in your
>code? i mean with the same or similar code can we generate for the
>fingerprint image?
What form does your hardware provide the image, byte array, char
string? array of ints? a number of fields?
It depends on that detail how to write a good hashCode and equals
method for you lookup.
It also depends on some collapsing. If you get the literal image, the
lookup key will not work since another crime scene image of the same
person will be slightly different. Hopefully some custom software has
analysed the image and converted to it set of repeatable numbers.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
pvs - 22 Oct 2005 03:06 GMT
Hi,
My prof. told me to take a fingerprint image that is available in
internet like .bmp or .jpg images and from that i have to generate
keys. i don't know whether it is possible from an image like that or i
have to take the fingerprint directly from a fingerprint reader and
generate the keys? you said that if it is a leteral image the key will
not work so is there any other way to generate?
Thanks,
PVS
Roedy Green - 22 Oct 2005 03:50 GMT
>My prof. told me to take a fingerprint image that is available in
>internet like .bmp or .jpg images and from that i have to generate
>keys. i don't know whether it is possible from an image like that or i
>have to take the fingerprint directly from a fingerprint reader and
>generate the keys? you said that if it is a leteral image the key will
>not work so is there any other way to generate?
hmm. This is just a toy. Sure, you can take a key from a bmp or any
other sort of image. The catch is to match you must use the EXACT same
image as a lookup key. See http://mindprod.com/jgloss/hashcode.html
and http://mindprod.com/jgloss/adler.html
and http://mindprod.com/jgloss/hashmap.html
and http://mindprod.com/jgloss/hashtable.html
for how to create a 32-bit hashcode from such a byte array.
If they key is off by even 1 bit, a hashMap won't find it. Obviously
this would be useless for matching sample fingerprints from crime
scene ones.
If you search google for "fingerprint encoding" or "fingerprint
analysis" you will discover there are all sorts of proprietary schemes
to look for features and encode them in under 200 bytes in a way that
a crime scene analysis would give a number the same or very close to
the original.
For "close to" you would use a TreeMap to look up fingerprints by
encoded fingerprint.

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Again taking new Java programming contracts.
pvs - 27 Oct 2005 16:19 GMT
Hi,
Thanks for your help.I will try as you mentioned.IF i have any question
i will contact you.
PVS