Files
herolib/aiprompts/v_core/crypto/crypto.internal.subtle.md
2025-09-02 07:28:13 +02:00

2.5 KiB

module crypto.internal.subtle

Contents

any_overlap

fn any_overlap(x []u8, y []u8) bool

Note: require unsafe in futureany_overlap reports whether x and y share memory at any (not necessarily corresponding) index. The memory beyond the slice length is ignored.

[Return to contents]

constant_time_byte_eq

fn constant_time_byte_eq(x u8, y u8) int

constant_time_byte_eq returns 1 when x == y.

[Return to contents]

constant_time_compare

fn constant_time_compare(x []u8, y []u8) int

constant_time_compare returns 1 when x and y have equal contents. The runtime of this function is proportional of the length of x and y. It is NOT dependent on their content.

[Return to contents]

constant_time_copy

fn constant_time_copy(v int, mut x []u8, y []u8)

constant_time_copy copies the contents of y into x, when v == 1. When v == 0, x is left unchanged. this function is undefined, when v takes any other value

[Return to contents]

constant_time_eq

fn constant_time_eq(x int, y int) int

constant_time_eq returns 1 when x == y.

[Return to contents]

constant_time_less_or_eq

fn constant_time_less_or_eq(x int, y int) int

constant_time_less_or_eq returns 1 if x <= y, and 0 otherwise. it is undefined when x or y are negative, or > (2^32 - 1)

[Return to contents]

constant_time_select

fn constant_time_select(v int, x int, y int) int

constant_time_select returns x when v == 1, and y when v == 0. it is undefined when v is any other value

[Return to contents]

inexact_overlap

fn inexact_overlap(x []u8, y []u8) bool

inexact_overlap reports whether x and y share memory at any non-corresponding index. The memory beyond the slice length is ignored. Note that x and y can have different lengths and still not have any inexact overlap.

inexact_overlap can be used to implement the requirements of the crypto/cipher AEAD, Block, BlockMode and Stream interfaces.

[Return to contents]

Powered by vdoc. Generated on: 2 Sep 2025 07:18:17