corda / net.corda.core.crypto / DigestService / computeNonce

computeNonce

fun computeNonce(privacySalt: PrivacySalt, groupIndex: Int, internalIndex: Int): SecureHash

Method to compute a nonce based on privacySalt, component group index and component internal index. SHA256d (double SHA256) is used to prevent length extension attacks.

Parameters

privacySalt - a PrivacySalt.

groupIndex - the fixed index (ordinal) of this component group.

internalIndex - the internal index of this object in its corresponding components list.

Return
HASH(HASH(privacySalt || groupIndex || internalIndex)) for SHA2-256 and other algorithms loaded via JCA MessageDigest, otherwise it's defined by DigestAlgorithm.nonceDigest(privacySalt || groupIndex || internalIndex).