Movatterモバイル変換


[0]ホーム

URL:


subtle

packagestandard library
go1.25.5Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 2, 2025 License:BSD-3-ClauseImports:3Imported by:0

Details

Repository

cs.opensource.google/go/go

Links

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

funcConstantTimeByteEq

func ConstantTimeByteEq(x, yuint8)int

ConstantTimeByteEq returns 1 if x == y and 0 otherwise.

funcConstantTimeCompare

func ConstantTimeCompare(x, y []byte)int

ConstantTimeCompare returns 1 if the two slices, x and y, have equal contentsand 0 otherwise. The time taken is a function of the length of the slices andis independent of the contents. If the lengths of x and y do not match itreturns 0 immediately.

funcConstantTimeCopy

func ConstantTimeCopy(vint, x, y []byte)

ConstantTimeCopy copies the contents of y into x (a slice of equal length)if v == 1. If v == 0, x is left unchanged. Its behavior is undefined if vtakes any other value.

funcConstantTimeEq

func ConstantTimeEq(x, yint32)int

ConstantTimeEq returns 1 if x == y and 0 otherwise.

funcConstantTimeLessOrEq

func ConstantTimeLessOrEq(x, yint)int

ConstantTimeLessOrEq returns 1 if x <= y and 0 otherwise.Its behavior is undefined if x or y are negative or > 2**31 - 1.

funcConstantTimeLessOrEqBytesadded ingo1.25.0

func ConstantTimeLessOrEqBytes(x, y []byte)int

ConstantTimeLessOrEqBytes returns 1 if x <= y and 0 otherwise. The comparisonis lexigraphical, or big-endian. The time taken is a function of the length ofthe slices and is independent of the contents. If the lengths of x and y do notmatch it returns 0 immediately.

funcConstantTimeSelect

func ConstantTimeSelect(v, x, yint)int

ConstantTimeSelect returns x if v == 1 and y if v == 0.Its behavior is undefined if v takes any other value.

funcXORBytes

func XORBytes(dst, x, y []byte)int

XORBytes sets dst[i] = x[i] ^ y[i] for all i < n = min(len(x), len(y)),returning n, the number of bytes written to dst.

If dst does not have length at least n,XORBytes panics without writing anything to dst.

dst and x or y may overlap exactly or not at all,otherwise XORBytes may panic.

Types

This section is empty.

Source Files

View all Source files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f orF : Jump to
y orY : Canonical URL
go.dev uses cookies from Google to deliver and enhance the quality of its services and to analyze traffic.Learn more.

[8]ページ先頭

©2009-2025 Movatter.jp