Update of /cvsroot/freenet/freenet/src/freenet/crypt
In directory sc8-pr-cvs1:/tmp/cvs-serv9009/src/freenet/crypt

Modified Files:
        DSAPublicKey.java 
Log Message:
6278:
Make Identify a (more or less) regular message. We pull the ref off it when we receive 
it, but later it gets executed by NewIdentify, which asks RT if it wants it, and if it 
does, verifies the signature (significant CPU operation!), and adds it.
Do NOT verify references on the RSL thread.
Cache fingerprint on DSAPublicKey


Index: DSAPublicKey.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/crypt/DSAPublicKey.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- DSAPublicKey.java   7 Jul 2003 23:22:42 -0000       1.4
+++ DSAPublicKey.java   25 Oct 2003 00:45:35 -0000      1.5
@@ -10,11 +10,14 @@
     private final String yAsHexString; //A cache of the hexadecimal string 
representation of y 
     private final DSAGroup group;
     
+       private byte[] fingerprint = null;
+    
     public DSAPublicKey(DSAGroup g, BigInteger y) {
                this.y=y;
                this.yAsHexString = y.toString(16);
                this.group=g;
     }
+       
     //Use this constructor if you have a Hex:ed version of y already available, will 
save some conversions and string allocations
        public DSAPublicKey(DSAGroup g, String yAsHexString) throws 
NumberFormatException {
                this.y=new BigInteger(yAsHexString,16);
@@ -119,7 +122,11 @@
     }
 
     public byte[] fingerprint() {
-               return fingerprint(new BigInteger[] {y});
+               synchronized(this) {
+                       if(fingerprint == null)
+                               fingerprint = fingerprint(new BigInteger[] {y});
+                       return fingerprint;
+               }
     }
        
     public boolean equals(DSAPublicKey o) {

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to