java.lang.Object
net.i2p.crypto.SipHashInline

public final class SipHashInlineextends Object
SipHash implementation with hand inlining the SIPROUND.

To know details about SipHash, see; "a fast short-input PRF" https://www.131002.net/siphash/

SIPROUND is defined in siphash24.c that can be downloaded from the above site. Following license notice is subject to change based on the licensing policy of siphash24.c.

I2P mods: add off/len version

For constant keys see net.i2p.util.SipHash.

  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Static class, no instances.
  • Method Summary

    All Methods
    Modifier and Type
    Method
    Description
    static long
    hash24(long k0, long k1, byte[] data)
    Hash the whole of data with SipHash-2-4 under a 16 byte key split across two longs.
    static long
    hash24(long k0, long k1, byte[] data, int off, int len)
    Hash a slice of data with SipHash-2-4 under a 16 byte key split across two longs.

    Methods inherited from class Object

    clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SipHashInline

      private SipHashInline()
      Static class, no instances.
  • Method Details

    • hash24

      public static long hash24(long k0, long k1, byte[] data)
      Hash the whole of data with SipHash-2-4 under a 16 byte key split across two longs.
      Parameters:
      k0 - the first 8 bytes of the key
      k1 - the last 8 bytes of the key
      data - the bytes to hash
      Returns:
      the 64-bit SipHash-2-4 output
    • hash24

      public static long hash24(long k0, long k1, byte[] data, int off, int len)
      Hash a slice of data with SipHash-2-4 under a 16 byte key split across two longs. Bytes outside the slice are ignored, so a message may be hashed in place without copying it.
      Parameters:
      k0 - the first 8 bytes of the key
      k1 - the last 8 bytes of the key
      data - the buffer holding the message
      off - index of the first message byte to absorb
      len - number of message bytes to absorb starting at off
      Returns:
      the 64-bit SipHash-2-4 output