tuweni / org.apache.tuweni.bytes / Bytes32 / secure

secure

open static fun secure(bytes: ByteArray!): Bytes32! (source)

Secures the provided byte array, which must be of length 32, as a Bytes32.

Parameters

bytes - ByteArray!: The bytes to secure.

Exceptions

IllegalArgumentException - if value.length != 32.

Return
Bytes32!: A Bytes32 securing value.

open static fun secure(bytes: ByteArray!, offset: Int): Bytes32! (source)

Secures a slice/sub-part of the provided array as a Bytes32.

Parameters

bytes - ByteArray!: The bytes to secure.

offset - Int: The index (inclusive) in value of the first byte exposed by the returned value. In other words, you will have wrap(value, i).get(0) == value[i].

Exceptions

IndexOutOfBoundsException - if offset < 0 || (value.length > 0 && offset >= value.length).

IllegalArgumentException - if length < 0 || offset + 32 > value.length.

Return
Bytes32!: A Bytes32 that holds securely the bytes of value from offset (inclusive) to offset + 32 (exclusive).