Class SalmonNonce

java.lang.Object
com.mku.salmon.SalmonNonce

public class SalmonNonce extends Object
Utility provides nonce operations.
  • Constructor Details

    • SalmonNonce

      public SalmonNonce()
  • Method Details

    • increaseNonce

      public static byte[] increaseNonce(byte[] startNonce, byte[] endNonce)
      Increase the sequential NONCE by a value of 1. This implementation assumes that the NONCE length is 8 bytes or fewer so it can fit in a long.
      Parameters:
      startNonce - The starting nonce.
      endNonce - The ending nonce in the sequence.
      Returns:
      The next nonce after incrementing.
      Throws:
      SalmonRangeExceededException - Thrown if the nonce exceeds its range
    • splitNonceRange

      public static byte[] splitNonceRange(byte[] startNonce, byte[] endNonce)
      Returns the middle nonce in the provided range. Note: This assumes the nonce is 8 bytes, if you need to increase the nonce length then the long transient variables will not hold. In that case you will need to override with your own implementation.
      Parameters:
      startNonce - The starting nonce.
      endNonce - The ending nonce in the sequence.
      Returns:
      The byte array with the middle nonce.
      Throws:
      SalmonSecurityException - Thrown if there is a security exception