subtle

package
v1.21.9 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package subtleは、暗号化コードでよく使用される関数を実装しますが、正しく使用するために注意深い考慮が必要です。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstantTimeByteEq

func ConstantTimeByteEq(x, y uint8) int

ConstantTimeByteEq は、x が y と等しい場合は1を、そうでない場合は0を返します。

func ConstantTimeCompare

func ConstantTimeCompare(x, y []byte) int

ConstantTimeCompareは、2つのスライスxとyが同じ内容を持つ場合は1を返し、そうでない場合は0を返します。実行時間はスライスの長さに依存し、内容には独立しています。xとyの長さが一致しない場合は、即座に0を返します。

func ConstantTimeCopy

func ConstantTimeCopy(v int, x, y []byte)

ConstantTimeCopyは、v == 1の場合、yの内容(長さが等しいスライス)をxにコピーします。 v == 0の場合、xは変更されません。vが他の値を取る場合の動作は未定義です。

func ConstantTimeEq

func ConstantTimeEq(x, y int32) int

ConstantTimeEqは、x == yの場合は1を返し、それ以外の場合は0を返します。

func ConstantTimeLessOrEq added in v1.2.0

func ConstantTimeLessOrEq(x, y int) int

ConstantTimeLessOrEq は、x ≤ y の場合は1を返し、そうでない場合は0を返します。 ただし、xまたはyが負数または2**31 - 1より大きい場合、動作は未定義です。

func ConstantTimeSelect

func ConstantTimeSelect(v, x, y int) int

ConstantTimeSelectは、vが1の場合はxを返し、vが0の場合はyを返します。 vが他の値を取る場合、動作は未定義です。

func XORBytes added in v1.20.0

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

XORBytesはdst[i] = x[i] ^ y[i]をi < n = min(len(x), len(y))のすべてのiに対して設定し、 dstに書き込まれたバイト数であるnを返します。 もしdstの長さが少なくともnでない場合、 XORBytesはなにもdstに書き込まずにパニックを起こします。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL