# package subtle
`import "crypto/subtle"`
Package subtle implements functions that are often useful in cryptographic code but require careful thought to use correctly.
## Index
* [func ConstantTimeByteEq(x, y uint8) int](#ConstantTimeByteEq)
* [func ConstantTimeEq(x, y int32) int](#ConstantTimeEq)
* [func ConstantTimeLessOrEq(x, y int) int](#ConstantTimeLessOrEq)
* [func ConstantTimeCompare(x, y []byte) int](#ConstantTimeCompare)
* [func ConstantTimeCopy(v int, x, y []byte)](#ConstantTimeCopy)
* [func ConstantTimeSelect(v, x, y int) int](#ConstantTimeSelect)
## func [ConstantTimeByteEq](https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go#L31 "View Source")
```
func ConstantTimeByteEq(x, y uint8) int
```
如果x == y返回1,否则返回0。
## func [ConstantTimeEq](https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go#L41 "View Source")
```
func ConstantTimeEq(x, y int32) int
```
如果x == y返回1,否则返回0。
## func [ConstantTimeLessOrEq](https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go#L70 "View Source")
```
func ConstantTimeLessOrEq(x, y int) int
```
如果x <= y返回1,否则返回0;如果x或y为负数,或者大于2\*\*31-1,函数行为是未定义的。
## func [ConstantTimeCompare](https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go#L12 "View Source")
```
func ConstantTimeCompare(x, y []byte) int
```
如果x、y的长度和内容都相同返回1;否则返回0。消耗的时间正比于切片长度而与内容无关。
## func [ConstantTimeCopy](https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go#L55 "View Source")
```
func ConstantTimeCopy(v int, x, y []byte)
```
如果v == 1,则将y的内容拷贝到x;如果v == 0,x不作修改;其他情况的行为是未定义并应避免的。
## func [ConstantTimeSelect](https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go#L28 "View Source")
```
func ConstantTimeSelect(v, x, y int) int
```
如果v == 1,返回x;如果v == 0,返回y;其他情况的行为是未定义并应避免的。
- 库
- package achive
- package tar
- package zip
- package bufio
- package builtin
- package bytes
- package compress
- package bzip2
- package flate
- package gzip
- package lzw
- package zlib
- package container
- package heap
- package list
- package ring
- package crypto
- package aes
- package cipher
- package des
- package dsa
- package ecdsa
- package elliptic
- package hmac
- package md5
- package rand
- package rc4
- package rsa
- package sha1
- package sha256
- package sha512
- package subtle
- package tls
- package x509
- package pkix
- package database
- package sql
- package driver
- package encoding
- package ascii85
- package asn1
- package base32
- package base64
- package binary
- package csv
- package gob
- package hex
- package json
- package pem
- package xml
- package errors
- package expvar
- package flag
- package fmt
- package go
- package doc
- package format
- package parser
- package printer
- package hash
- package adler32
- package crc32
- package crc64
- package fnv
- package html
- package template
- package image
- package color
- package palette
- package draw
- package gif
- package jpeg
- package png
- package index
- package suffixarray
- package io
- package ioutil
- package log
- package syslog
- package math
- package big
- package cmplx
- package rand
- package mime
- package multipart
- package net
- package http
- package cgi
- package cookiejar
- package fcgi
- package httptest
- package httputil
- package pprof
- package mail
- package rpc
- package jsonrpc
- package smtp
- package textproto
- package url
- package os
- package exec
- package signal
- package user
- package path
- package filepath
- package reflect
- package regexp
- package runtime
- package cgo
- package debug
- package pprof
- package race
- package sort
- package strconv
- package strings
- package sync
- package atomic
- package text
- package scanner
- package tabwriter
- package template
- package time
- package unicode
- package utf16
- package utf8
- package unsafe