-
Notifications
You must be signed in to change notification settings - Fork 0
/
crypto_subtle.htm
45 lines (45 loc) · 4 KB
/
crypto_subtle.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<!DOCTYPE html>
<html lang="en">
<head profile="http://a9.com/-/spec/opensearch/1.1/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="./site.css" rel="stylesheet">
<title>crypto/subtle</title>
</head>
<body>
<div class="container">
<h2 id="pkg-overview">package subtle</h2>
<p><code>import "crypto/subtle"</code>
<p>Package subtle implements functions that are often useful in cryptographic
code but require careful thought to use correctly.</p>
<h3 id="pkg-index" class="section-header">Index <a class="permalink" href="#pkg-index">¶</a></h3>
<a href="../main.html"><h3>返回首页</h3></a>
</br>
<li><a href="#ConstantTimeByteEq">func ConstantTimeByteEq(x, y uint8) int</a></li>
<li><a href="#ConstantTimeEq">func ConstantTimeEq(x, y int32) int</a></li>
<li><a href="#ConstantTimeLessOrEq">func ConstantTimeLessOrEq(x, y int) int</a></li>
<li><a href="#ConstantTimeCompare">func ConstantTimeCompare(x, y []byte) int</a></li>
<li><a href="#ConstantTimeCopy">func ConstantTimeCopy(v int, x, y []byte)</a></li>
<li><a href="#ConstantTimeSelect">func ConstantTimeSelect(v, x, y int) int</a></li>
</ul>
<h3 id="ConstantTimeByteEq">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go?name=release#31">ConstantTimeByteEq</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func ConstantTimeByteEq(x, y <a href="builtin.htm#uint8">uint8</a>) <a href="builtin.htm#int">int</a></pre>
<p>如果x == y返回1,否则返回0。</p>
<h3 id="ConstantTimeEq">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go?name=release#41">ConstantTimeEq</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func ConstantTimeEq(x, y <a href="builtin.htm#int32">int32</a>) <a href="builtin.htm#int">int</a></pre>
<p>如果x == y返回1,否则返回0。</p>
<h3 id="ConstantTimeLessOrEq">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go?name=release#70">ConstantTimeLessOrEq</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func ConstantTimeLessOrEq(x, y <a href="builtin.htm#int">int</a>) <a href="builtin.htm#int">int</a></pre>
<p>如果x <= y返回1,否则返回0;如果x或y为负数,或者大于2**31-1,函数行为是未定义的。</p>
<h3 id="ConstantTimeCompare">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go?name=release#12">ConstantTimeCompare</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func ConstantTimeCompare(x, y []<a href="builtin.htm#byte">byte</a>) <a href="builtin.htm#int">int</a></pre>
<p>如果x、y的长度和内容都相同返回1;否则返回0。消耗的时间正比于切片长度而与内容无关。</p>
<h3 id="ConstantTimeCopy">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go?name=release#55">ConstantTimeCopy</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func ConstantTimeCopy(v <a href="builtin.htm#int">int</a>, x, y []<a href="builtin.htm#byte">byte</a>)</pre>
<p>如果v == 1,则将y的内容拷贝到x;如果v == 0,x不作修改;其他情况的行为是未定义并应避免的。</p>
<h3 id="ConstantTimeSelect">func <a title="View Source" href="https://github.com/golang/go/blob/master/src/crypto/subtle/constant_time.go?name=release#28">ConstantTimeSelect</a> <a class="permalink" href="#pkg-index">¶</a></h3>
<pre class="funcdecl">func ConstantTimeSelect(v, x, y <a href="builtin.htm#int">int</a>) <a href="builtin.htm#int">int</a></pre>
<p>如果v == 1,返回x;如果v == 0,返回y;其他情况的行为是未定义并应避免的。</p>
</div>
</body>
</html>