Privacy Salt
A privacy salt is required to compute nonces per transaction component in order to ensure that an adversary cannot use brute force techniques and reveal the content of a Merkle-leaf hashed value. Because this salt serves the role of the seed to compute nonces, its size and entropy should be equal to the underlying hash function used for Merkle tree generation, currently SecureHash.SHA256, which has an output of 32 bytes. There are two constructors, one that generates a new 32-bytes random salt, and another that takes a ByteArray input. The latter is required in cases where the salt value needs to be pre-generated (agreed between transacting parties), but it is highlighted that one should always ensure it has sufficient entropy.
Properties
The bytes are always cloned so that this object becomes immutable. This has been done to prevent tampering with entities such as net.corda.core.crypto.SecureHash and net.corda.core.contracts.PrivacySalt, as well as preserve the integrity of our hash constants net.corda.core.crypto.SecureHash.zeroHash and net.corda.core.crypto.SecureHash.allOnesHash.
Functions
Compare byte arrays byte by byte. Arrays that are shorter are deemed less than longer arrays if all the bytes of the shorter array equal those in the same position of the longer array.
Copy this sequence, complete with new backing array. This can be helpful to break references to potentially large backing arrays from small sub-sequences.
Convenience extension method for deserializing a ByteSequence, utilising the defaults.
Additionally returns SerializationContext which was used for encoding. It might be helpful to know SerializationContext to use the same encoding in the reply.
Compute the algorithm hash for the contents of the OpaqueBytes.
Returns a ByteArrayInputStream of the bytes.
Write this sequence to a ByteBuffer.
Compute the SHA-256 hash for the contents of the OpaqueBytes.
A new read-only ByteBuffer view of this sequence or part of it. If start or end are negative then IllegalArgumentException is thrown, otherwise they are clamped if necessary. This method cannot be used to get bytes before offset or after offset+size, and never makes a new array.
Create a sub-sequence of this sequence. A copy of the underlying array may be made, if a subclass overrides bytes to do so, as OpaqueBytes does.
Take the first n bytes of this sequence as a sub-sequence. See subSequence for further semantics.
Write this sequence to an OutputStream.