Record Class ModuleLatticeKemResult

java.lang.Object
java.lang.Record
net.jrodolfo.java_evolution.java24.quantum_resistant_crypto.ModuleLatticeKemResult
Record Components:
senderSecretBytes - the shared secret bytes created by the sender
receiverSecretBytes - the shared secret bytes recovered by the receiver
encapsulation - the message sent from sender to receiver
algorithm - the KEM algorithm used by the example

public record ModuleLatticeKemResult(byte[] senderSecretBytes, byte[] receiverSecretBytes, byte[] encapsulation, String algorithm) extends Record
Captures the observable pieces of a module-lattice KEM exchange.

The result keeps the example readable without printing key material. The sender and receiver secrets are included only so tests can prove that both sides derived the same shared secret.

  • Constructor Details

    • ModuleLatticeKemResult

      public ModuleLatticeKemResult(byte[] senderSecretBytes, byte[] receiverSecretBytes, byte[] encapsulation, String algorithm)
      Creates an immutable KEM result.
  • Method Details

    • senderSecretBytes

      public byte[] senderSecretBytes()
      Returns the value of the senderSecretBytes record component.
      Returns:
      the value of the senderSecretBytes record component
    • receiverSecretBytes

      public byte[] receiverSecretBytes()
      Returns the value of the receiverSecretBytes record component.
      Returns:
      the value of the receiverSecretBytes record component
    • encapsulation

      public byte[] encapsulation()
      Returns the value of the encapsulation record component.
      Returns:
      the value of the encapsulation record component
    • secretsMatch

      public boolean secretsMatch()
      Shows whether encapsulation and decapsulation reached the same secret.
      Returns:
      true when both sides derived matching key material
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • algorithm

      public String algorithm()
      Returns the value of the algorithm record component.
      Returns:
      the value of the algorithm record component