File: _lib---3rdParty---phpseclib---Crypt---RC4.php.html

package info (click to toggle)
ldap-account-manager 3.7-2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 34,660 kB
  • sloc: php: 49,813; perl: 305; makefile: 169; sh: 156; pascal: 132; xml: 111
file content (146 lines) | stat: -rw-r--r-- 10,095 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<html>
<head>
<title>Docs for page RC4.php</title>
<link rel="stylesheet" type="text/css" href="../media/style.css">
</head>
<body>

<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
  <tr>
    <td class="header_top">Crypt_RC4</td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
  <tr>
    <td class="header_menu">
        
                                                                                                                                                            
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              		  [ <a href="../classtrees_Crypt_RC4.html" class="menu">class tree: Crypt_RC4</a> ]
		  [ <a href="../elementindex_Crypt_RC4.html" class="menu">index: Crypt_RC4</a> ]
		  	    [ <a href="../elementindex.html" class="menu">all elements</a> ]
    </td>
  </tr>
  <tr><td class="header_line"><img src="../media/empty.png" width="1" height="1" border="0" alt=""  /></td></tr>
</table>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="200" class="menu">
	<div id="ric">
					<p><a href="../ric_README.html">README</a></p>
			</div>
	<div id="todolist">
			<p><a href="../todolist.html">Todo List</a></p>
	</div>
      <b>Packages:</b><br />
              <a href="../li_main.html">main</a><br />
              <a href="../li_configuration.html">configuration</a><br />
              <a href="../li_Crypt_AES.html">Crypt_AES</a><br />
              <a href="../li_Crypt_DES.html">Crypt_DES</a><br />
              <a href="../li_Crypt_Hash.html">Crypt_Hash</a><br />
              <a href="../li_Crypt_Random.html">Crypt_Random</a><br />
              <a href="../li_Crypt_RC4.html">Crypt_RC4</a><br />
              <a href="../li_Crypt_Rijndael.html">Crypt_Rijndael</a><br />
              <a href="../li_Crypt_RSA.html">Crypt_RSA</a><br />
              <a href="../li_Crypt_TerraDES.html">Crypt_TerraDES</a><br />
              <a href="../li_Crypt_TripleDES.html">Crypt_TripleDES</a><br />
              <a href="../li_default.html">default</a><br />
              <a href="../li_Help.html">Help</a><br />
              <a href="../li_horde-cipher.html">horde-cipher</a><br />
              <a href="../li_lam.html">lam</a><br />
              <a href="../li_LDAP.html">LDAP</a><br />
              <a href="../li_lib.html">lib</a><br />
              <a href="../li_lists.html">lists</a><br />
              <a href="../li_Math_BigInteger.html">Math_BigInteger</a><br />
              <a href="../li_metaHTML.html">metaHTML</a><br />
              <a href="../li_modules.html">modules</a><br />
              <a href="../li_Net_SFTP.html">Net_SFTP</a><br />
              <a href="../li_Net_SSH1.html">Net_SSH1</a><br />
              <a href="../li_Net_SSH2.html">Net_SSH2</a><br />
              <a href="../li_PDF.html">PDF</a><br />
              <a href="../li_phpLDAPadmin.html">phpLDAPadmin</a><br />
              <a href="../li_PHP_Compat.html">PHP_Compat</a><br />
              <a href="../li_profiles.html">profiles</a><br />
              <a href="../li_selfService.html">selfService</a><br />
              <a href="../li_tools.html">tools</a><br />
              <a href="../li_types.html">types</a><br />
            <br /><br />
                        <b>Files:</b><br />
      	  <div class="package">
			<a href="../Crypt_RC4/_lib---3rdParty---phpseclib---Crypt---RC4.php.html">		RC4.php
		</a><br>
	  </div><br />
      
      
            <b>Classes:</b><br />
        <div class="package">
		    		<a href="../Crypt_RC4/Crypt_RC4.html">Crypt_RC4</a><br />
	  </div>
                </td>
    <td>
      <table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">

<h1>Procedural File: RC4.php</h1>
Source Location: /lib/3rdParty/phpseclib/Crypt/RC4.php<br /><br />

<br>
<br>

<div class="contents">
<h2>Classes:</h2>
<dt><a href="../Crypt_RC4/Crypt_RC4.html">Crypt_RC4</a></dt>
	<dd>Pure-PHP implementation of RC4.</dd>
</div><br /><br />

<h2>Page Details:</h2>
Pure-PHP implementation of RC4.<br /><br /><p>Uses mcrypt, if available, and an internal implementation, otherwise.</p><p>PHP versions 4 and 5</p><p>Useful resources are as follows:</p><p><ul><li><a href="http://www.mozilla.org/projects/security/pki/nss/draft-kaukonen-cipher-arcfour-03.txt">ARCFOUR Algorithm</a></li><li><a href="http://en.wikipedia.org/wiki/RC4">- Wikipedia: RC4</a></li></ul>  RC4 is also known as ARCFOUR or ARC4.  The reason is elaborated upon at Wikipedia.  This class is named RC4 and not  ARCFOUR or ARC4 because RC4 is how it is refered to in the SSH1 specification.</p><p>Here's a short example of how to use this library:  <ol><li><div class="src-line">&nbsp;<span class="src-php">&lt;?php</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-inc">include</span><span class="src-sym">(</span><span class="src-str">'Crypt/RC4.php'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$rc4&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../Crypt_RC4/Crypt_RC4.html">Crypt_RC4</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$rc4</span><span class="src-sym">-&gt;</span><span class="src-id">setKey</span><span class="src-sym">(</span><span class="src-str">'abcdefgh'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$size&nbsp;</span>=&nbsp;<span class="src-num">10&nbsp;</span>*&nbsp;<span class="src-num">1024</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$plaintext&nbsp;</span>=&nbsp;<span class="src-str">''</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">for&nbsp;</span><span class="src-sym">(</span><span class="src-var">$i&nbsp;</span>=&nbsp;<span class="src-num">0</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i&nbsp;</span>&lt;&nbsp;<span class="src-var">$size</span><span class="src-sym">;&nbsp;</span><span class="src-var">$i</span>++<span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$plaintext</span>.=&nbsp;<span class="src-str">'a'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}</span></div></li>
<li><div class="src-line">&nbsp;</div></li>
<li><div class="src-line">&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-var">$rc4</span><span class="src-sym">-&gt;</span><span class="src-id">decrypt</span><span class="src-sym">(</span><span class="src-var">$rc4</span><span class="src-sym">-&gt;</span><span class="src-id">encrypt</span><span class="src-sym">(</span><span class="src-var">$plaintext</span><span class="src-sym">))</span><span class="src-sym">;</span></div></li>
<li><div class="src-line">&nbsp;<span class="src-php">?&gt;</span></div></li>
</ol></p><p>LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy  of this software and associated documentation files (the &quot;Software&quot;), to deal  in the Software without restriction, including without limitation the rights  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell  copies of the Software, and to permit persons to whom the Software is  furnished to do so, subject to the following conditions:</p><p>The above copyright notice and this permission notice shall be included in  all copies or substantial portions of the Software.</p><p>THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN  THE SOFTWARE.</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><b>author:</b>&nbsp;&nbsp;</td><td>Jim Wigginton &lt;<a href="mailto:terrafrost@php.net">terrafrost@php.net</a>&gt;</td>
  </tr>
  <tr>
    <td><b>version:</b>&nbsp;&nbsp;</td><td>$Id: RC4.php,v 1.2 2011/05/19 18:02:11 gruberroland Exp $</td>
  </tr>
  <tr>
    <td><b>copyright:</b>&nbsp;&nbsp;</td><td>MMVII Jim Wigginton</td>
  </tr>
  <tr>
    <td><b>link:</b>&nbsp;&nbsp;</td><td><a href="http://phpseclib.sourceforge.net">http://phpseclib.sourceforge.net</a></td>
  </tr>
  <tr>
    <td><b>license:</b>&nbsp;&nbsp;</td><td><a href="http://www.opensource.org/licenses/mit-license.html">MIT License</a></td>
  </tr>
</table>
</div>
<br /><br />
<br /><br />
<br /><br />
<br />

        <div class="credit">
		    <hr />
		    Documentation generated on Sun, 25 Mar 2012 19:35:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
	      </div>
      </td></tr></table>
    </td>
  </tr>
</table>

</body>
</html>