Author: toad
Date: 2007-01-30 16:13:46 +0000 (Tue, 30 Jan 2007)
New Revision: 11646

Modified:
   trunk/freenet/src/freenet/crypt/DSAPublicKey.java
Log:
be lazy

Modified: trunk/freenet/src/freenet/crypt/DSAPublicKey.java
===================================================================
--- trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2007-01-30 15:23:16 UTC 
(rev 11645)
+++ trunk/freenet/src/freenet/crypt/DSAPublicKey.java   2007-01-30 16:13:46 UTC 
(rev 11646)
@@ -17,7 +17,7 @@

     private final BigInteger y;
        /** A cache of the hexadecimal string representation of y */
-    private final String yAsHexString; 
+    private String yAsHexString; 

     public static final int PADDED_SIZE = 1024;

@@ -27,7 +27,6 @@

     public DSAPublicKey(DSAGroup g, BigInteger y) {
                this.y=y;
-               this.yAsHexString = HexUtil.biToHex(y);
                this.group=g;
                if(g == null) throw new NullPointerException();
     }
@@ -50,7 +49,6 @@
     public DSAPublicKey(InputStream is) throws IOException {
                group=(DSAGroup) DSAGroup.read(is);
                y=Util.readMPI(is);
-               this.yAsHexString = HexUtil.biToHex(y);
     }

     public DSAPublicKey(byte[] pubkeyAsBytes) throws IOException {
@@ -62,6 +60,8 @@
     }

        public String getYAsHexString() {
+               if(yAsHexString == null)
+                       this.yAsHexString = HexUtil.biToHex(y);
                return yAsHexString;
        }



Reply via email to