All Implemented Interfaces:
DataStructure
Direct Known Subclasses:
InfoHash, NID, TokenKey

public class SHA1Hashextends SimpleDataStructure
I2P data structure for SHA-1 hash values.

This class provides a SimpleDataStructure wrapper for 20-byte SHA-1 hashes used throughout I2P for data integrity and identification purposes. It extends SimpleDataStructure to support I2P's serialization framework and provides efficient caching of hash codes.

Common uses include:

  • Router and destination identifiers
  • Message integrity verification
  • Data structure indexing and lookup
  • Field Details

    • _cachedHashCode

      private int _cachedHashCode
      Hash of the data, computed on demand and then kept.
    • HASH_LENGTH

      public static final int HASH_LENGTH
      Number of bytes in a SHA-1 hash.
      See Also:
  • Constructor Details

    • SHA1Hash

      public SHA1Hash()
      Create an empty SHA-1 hash (data is null).
    • SHA1Hash

      public SHA1Hash(byte[] data)
      Create a SHA-1 hash from the given data.
      Parameters:
      data - the 20-byte SHA-1 hash data
      Throws:
      IllegalArgumentException - if data is not 20 bytes (null is ok)
  • Method Details