Skip to content

Kotlin/Js implementation's copy buffer is unnecessary #52

@05nelsonm

Description

@05nelsonm

Kotlin/Js a ByteArray can be converted to a Uint8Array view, then populated with securely random data which will reflect as such in the ByteArray

val b = ByteArray(20)
val bchcBefore = b.contentHashCode()
val int8 = b.unsafeCast<Int8Array>()
val uint8 = Uint8Array(buffer = int8.buffer)
jsCryptoFill(uint8)
assertNotEquals(bchcBefore, b.contentHashCode())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions