summaryrefslogtreecommitdiff
path: root/devdocs/go/crypto%2Frc4%2Findex.html
blob: 51f33835c0def204ca772bbe48aaf842cf917d31 (plain)
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
<h1> Package rc4  </h1>     <ul id="short-nav">
<li><code>import "crypto/rc4"</code></li>
<li><a href="#pkg-overview" class="overviewLink">Overview</a></li>
<li><a href="#pkg-index" class="indexLink">Index</a></li>
</ul>     <h2 id="pkg-overview">Overview </h2> <p>Package rc4 implements RC4 encryption, as defined in Bruce Schneier's Applied Cryptography. </p>
<p>RC4 is cryptographically broken and should not be used for secure applications. </p>     <h2 id="pkg-index">Index </h2>  <ul id="manual-nav">
<li><a href="#Cipher">type Cipher</a></li>
<li> <a href="#NewCipher">func NewCipher(key []byte) (*Cipher, error)</a>
</li>
<li> <a href="#Cipher.Reset">func (c *Cipher) Reset()</a>
</li>
<li> <a href="#Cipher.XORKeyStream">func (c *Cipher) XORKeyStream(dst, src []byte)</a>
</li>
<li><a href="#KeySizeError">type KeySizeError</a></li>
<li> <a href="#KeySizeError.Error">func (k KeySizeError) Error() string</a>
</li>
</ul> <h3>Package files</h3> <p>  <span>rc4.go</span>  </p>   <h2 id="Cipher">type <span>Cipher</span>  </h2> <p>A Cipher is an instance of RC4 using a particular key. </p>
<pre data-language="go">type Cipher struct {
    // contains filtered or unexported fields
}
</pre> <h3 id="NewCipher">func <span>NewCipher</span>  </h3> <pre data-language="go">func NewCipher(key []byte) (*Cipher, error)</pre> <p>NewCipher creates and returns a new <a href="#Cipher">Cipher</a>. The key argument should be the RC4 key, at least 1 byte and at most 256 bytes. </p>
<h3 id="Cipher.Reset">func (*Cipher) <span>Reset</span>  </h3> <pre data-language="go">func (c *Cipher) Reset()</pre> <p>Reset zeros the key data and makes the <a href="#Cipher">Cipher</a> unusable. </p>
<p>Deprecated: Reset can't guarantee that the key will be entirely removed from the process's memory. </p>
<h3 id="Cipher.XORKeyStream">func (*Cipher) <span>XORKeyStream</span>  </h3> <pre data-language="go">func (c *Cipher) XORKeyStream(dst, src []byte)</pre> <p>XORKeyStream sets dst to the result of XORing src with the key stream. Dst and src must overlap entirely or not at all. </p>
<h2 id="KeySizeError">type <span>KeySizeError</span>  </h2> <pre data-language="go">type KeySizeError int</pre> <h3 id="KeySizeError.Error">func (KeySizeError) <span>Error</span>  </h3> <pre data-language="go">func (k KeySizeError) Error() string</pre><div class="_attribution">
  <p class="_attribution-p">
    &copy; Google, Inc.<br>Licensed under the Creative Commons Attribution License 3.0.<br>
    <a href="http://golang.org/pkg/crypto/rc4/" class="_attribution-link">http://golang.org/pkg/crypto/rc4/</a>
  </p>
</div>