Changeset ef7b3e0 for core


Ignore:
Timestamp:
Jun 26, 2018 8:29:19 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
c02f685
Parents:
baa11d8
Message:

Core: misc. minor changes

Location:
core/java/src/net/i2p
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/crypto/HMAC256Generator.java

    rbaa11d8 ref7b3e0  
    129129     */
    130130/****
     131    private static final int LENGTH = 33;
     132
    131133    public static void main(String args[]) {
    132134        I2PAppContext ctx = I2PAppContext.getGlobalContext();
    133135        byte[] rand = new byte[32];
    134         byte[] data = new byte[1500];
     136        byte[] data = new byte[LENGTH];
    135137        Key keyObj = new SecretKeySpec(rand, "HmacSHA256");
    136138        SessionKey key = new SessionKey(rand);
  • core/java/src/net/i2p/crypto/SipHashInline.java

    rbaa11d8 ref7b3e0  
    212212        return v0 ^ v1 ^ v2 ^ v3;
    213213    }
     214
     215    /**
     216     *  Test vectors from https://www.131002.net/siphash/siphash.pdf
     217     */
     218/****
     219    public static void main(String[] args) {
     220        long k0 = 0x0706050403020100L;
     221        long k1 = 0x0f0e0d0c0b0a0908L;
     222        byte[] data = new byte[15];
     223        for (int i = 0; i < data.length; i++) {
     224            data[i] = (byte) i;
     225        }
     226        long result = hash24(k0, k1, data);
     227        long expect = 0xa129ca6149be45e5L;
     228        if (result == expect)
     229            System.out.println("PASS");
     230        else
     231            System.out.println("FAIL expect " + Long.toString(expect, 16) +
     232                               " got " + Long.toString(result, 16));
     233    }
     234****/
    214235}
  • core/java/src/net/i2p/data/DataHelper.java

    rbaa11d8 ref7b3e0  
    9595            // BlockfileNamingService
    9696            "version", "created", "upgraded", "lists",
    97             "a", "m", "s", "v"
     97            "a", "m", "s", "v", "notes",
     98            // NTCP2 RouterAddress options
     99            "i"
    98100        };
    99101        _propertiesKeyCache = new HashMap<String, String>(keys.length);
     
    671673       
    672674        if (rv < 0)
    673             throw new DataFormatException("fromLong got a negative? " + rv + " numBytes=" + numBytes);
     675            throw new DataFormatException("readLong got a negative? " + rv + " numBytes=" + numBytes);
    674676        return rv;
    675677    }
  • core/java/src/net/i2p/util/HexDump.java

    rbaa11d8 ref7b3e0  
    2828    private static final int FORMAT_OFFSET_PADDING = 8;
    2929    private static final int FORMAT_BYTES_PER_ROW = 16;
     30    private static final int OUTPUT_BYTES_PER_ROW = 79;
    3031    private static final byte[] HEXCHARS = DataHelper.getASCII("0123456789abcdef");
    3132
     
    3637     */
    3738    public static String dump(byte[] data) {
    38         ByteArrayOutputStream out = new ByteArrayOutputStream();
    39 
    40         try {
    41             dump(data, 0, data.length, out);
    42             return out.toString("ISO-8859-1");
    43         } catch (IOException e) {
    44             throw new RuntimeException("no 8859?", e);
    45         }
     39        return dump(data, 0, data.length);
    4640    }
    4741
     
    5448     */
    5549    public static String dump(byte[] data, int off, int len) {
    56         ByteArrayOutputStream out = new ByteArrayOutputStream();
     50        int outlen = OUTPUT_BYTES_PER_ROW * (len + FORMAT_BYTES_PER_ROW - 1) / FORMAT_BYTES_PER_ROW;
     51        ByteArrayOutputStream out = new ByteArrayOutputStream(outlen);
    5752
    5853        try {
  • core/java/src/net/i2p/util/I2PSSLSocketFactory.java

    rbaa11d8 ref7b3e0  
    145145     *  We exclude everything that Java 8 disables by default, plus some others.
    146146     *  ref: http://docs.oracle.com/javase/8/docs/technotes/guides/security/SunProviders.html
     147     *  See also: https://developer.android.com/reference/javax/net/ssl/SSLSocket.html
    147148     *  Unmodifiable.
    148149     *  Public for RouterConsoleRunner.
  • core/java/src/net/i2p/util/SystemVersion.java

    rbaa11d8 ref7b3e0  
    341341        System.out.println("Linux Svc: " + isLinuxService());
    342342        System.out.println("Mac      : " + isMac());
     343        System.out.println("Max mem  : " + getMaxMemory());
    343344        System.out.println("OpenJDK  : " + isOpenJDK());
    344345        System.out.println("Slow     : " + isSlow());
     
    346347        System.out.println("Wrapper  : " + hasWrapper());
    347348        System.out.println("x86      : " + isX86());
    348         System.out.println("Max mem  : " + getMaxMemory());
    349349
    350350    }
Note: See TracChangeset for help on using the changeset viewer.