ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
phpseclib\Crypt\DES Class Reference
+ Inheritance diagram for phpseclib\Crypt\DES:
+ Collaboration diagram for phpseclib\Crypt\DES:

Public Member Functions

 isValidEngine ($engine)
 Test for engine validity. More...
 
 setKey ($key)
 Sets the key. More...
 
 _encryptBlock ($in)
 Encrypts a block. More...
 
 _decryptBlock ($in)
 Decrypts a block. More...
 
 _processBlock ($block, $mode)
 Encrypts or decrypts a 64-bit block. More...
 
 _setupKey ()
 Creates the key schedule. More...
 
 _setupInlineCrypt ()
 Setup the performance-optimized function for de/encrypt() More...
 
- Public Member Functions inherited from phpseclib\Crypt\Base
 __construct ($mode=self::MODE_CBC)
 Default Constructor. More...
 
 setIV ($iv)
 Sets the initialization vector. More...
 
 setKeyLength ($length)
 Sets the key length. More...
 
 getKeyLength ()
 Returns the current key length in bits. More...
 
 getBlockLength ()
 Returns the current block length in bits. More...
 
 setKey ($key)
 Sets the key. More...
 
 setPassword ($password, $method='pbkdf2')
 Sets the password. More...
 
 encrypt ($plaintext)
 Encrypts a message. More...
 
 decrypt ($ciphertext)
 Decrypts a message. More...
 
 _openssl_ctr_process ($plaintext, &$encryptIV, &$buffer)
 OpenSSL CTR Processor. More...
 
 _openssl_ofb_process ($plaintext, &$encryptIV, &$buffer)
 OpenSSL OFB Processor. More...
 
 _openssl_translate_mode ()
 phpseclib <-> OpenSSL Mode Mapper More...
 
 enablePadding ()
 Pad "packets". More...
 
 disablePadding ()
 Do not pad packets. More...
 
 enableContinuousBuffer ()
 Treat consecutive "packets" as if they are a continuous buffer. More...
 
 disableContinuousBuffer ()
 Treat consecutive packets as if they are a discontinuous buffer. More...
 
 isValidEngine ($engine)
 Test for engine validity. More...
 
 setPreferredEngine ($engine)
 Sets the preferred crypt engine. More...
 
 getEngine ()
 Returns the engine currently being utilized. More...
 
 _setEngine ()
 Sets the engine as appropriate. More...
 
 _encryptBlock ($in)
 Encrypts a block. More...
 
 _decryptBlock ($in)
 Decrypts a block. More...
 
 _setupKey ()
 Setup the key (expansion) More...
 
 _setup ()
 Setup the self::ENGINE_INTERNAL $engine. More...
 
 _setupMcrypt ()
 Setup the self::ENGINE_MCRYPT $engine. More...
 
 _pad ($text)
 Pads a string. More...
 
 _unpad ($text)
 Unpads a string. More...
 
 _clearBuffers ()
 Clears internal buffers. More...
 
 _string_shift (&$string, $index=1)
 String Shift. More...
 
 _string_pop (&$string, $index=1)
 String Pop. More...
 
 _increment_str (&$var)
 Increment the current string. More...
 
 _setupInlineCrypt ()
 Setup the performance-optimized function for de/encrypt() More...
 
 _createInlineCryptFunction ($cipher_code)
 Creates the performance-optimized function for en/decrypt() More...
 
_getLambdaFunctions ()
 Holds the lambda_functions table (classwide) More...
 
 _hashInlineCryptFunction ($bytes)
 Generates a digest from $bytes. More...
 

Data Fields

const ENCRYPT = 0
 #+ @access private More...
 
const DECRYPT = 1
 Contains $keys[self::DECRYPT]. More...
 
 $block_size = 8
 
 $key_length = 8
 
 $cipher_name_mcrypt = 'des'
 
 $openssl_mode_names
 
 $cfb_init_len = 500
 
 $des_rounds = 1
 
 $key_length_max = 8
 
 $keys
 
 $shuffle
 
 $ipmap
 
 $invipmap
 
 $sbox1
 
 $sbox2
 
 $sbox3
 
 $sbox4
 
 $sbox5
 
 $sbox6
 
 $sbox7
 
 $sbox8
 
- Data Fields inherited from phpseclib\Crypt\Base
const MODE_CTR = -1
 #+ @access public More...
 
const MODE_ECB = 1
 Encrypt / decrypt using the Electronic Code Book mode. More...
 
const MODE_CBC = 2
 Encrypt / decrypt using the Code Book Chaining mode. More...
 
const MODE_CFB = 3
 Encrypt / decrypt using the Cipher Feedback mode. More...
 
const MODE_OFB = 4
 Encrypt / decrypt using the Output Feedback mode. More...
 
const MODE_STREAM = 5
 Encrypt / decrypt using streaming mode. More...
 
const ENGINE_INTERNAL = 1
 #+ @access private More...
 
const ENGINE_MCRYPT = 2
 Base value for the mcrypt implementation $engine switch. More...
 
const ENGINE_OPENSSL = 3
 Base value for the mcrypt implementation $engine switch. More...
 
 $mode
 
 $block_size = 16
 
 $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
 
 $iv
 
 $encryptIV
 
 $decryptIV
 
 $continuousBuffer = false
 
 $enbuffer
 
 $debuffer
 
 $enmcrypt
 
 $demcrypt
 
 $enchanged = true
 
 $dechanged = true
 
 $ecb
 
 $cfb_init_len = 600
 
 $changed = true
 
 $padding = true
 
 $paddable = false
 
 $engine
 
 $preferredEngine
 
 $cipher_name_mcrypt
 
 $cipher_name_openssl
 
 $cipher_name_openssl_ecb
 
 $password_default_salt = 'phpseclib/salt'
 
 $inline_crypt
 
 $use_inline_crypt
 
 $openssl_emulate_ctr = false
 
 $openssl_options
 
 $explicit_key_length = false
 
 $skip_key_adjustment = false
 

Additional Inherited Members

- Static Public Attributes inherited from phpseclib\Crypt\Base
static $WHIRLPOOL_AVAILABLE
 

Detailed Description

Definition at line 54 of file DES.php.

Member Function Documentation

◆ _decryptBlock()

phpseclib\Crypt\DES::_decryptBlock (   $in)

Decrypts a block.

See also
\phpseclib\Crypt\Base::_decryptBlock()
\phpseclib\Crypt\Base::decrypt()
self::decrypt() @access private
Parameters
string$in
Returns
string

Reimplemented from phpseclib\Crypt\Base.

Definition at line 657 of file DES.php.

658 {
659 return $this->_processBlock($in, self::DECRYPT);
660 }
if(php_sapi_name() !='cli') $in
Definition: Utf8Test.php:37
_processBlock($block, $mode)
Encrypts or decrypts a 64-bit block.
Definition: DES.php:676

References $in, and phpseclib\Crypt\DES\_processBlock().

+ Here is the call graph for this function:

◆ _encryptBlock()

phpseclib\Crypt\DES::_encryptBlock (   $in)

Encrypts a block.

See also
\phpseclib\Crypt\Base::_encryptBlock()
\phpseclib\Crypt\Base::encrypt()
self::encrypt() @access private
Parameters
string$in
Returns
string

Reimplemented from phpseclib\Crypt\Base.

Definition at line 642 of file DES.php.

643 {
644 return $this->_processBlock($in, self::ENCRYPT);
645 }

References $in, and phpseclib\Crypt\DES\_processBlock().

+ Here is the call graph for this function:

◆ _processBlock()

phpseclib\Crypt\DES::_processBlock (   $block,
  $mode 
)

Encrypts or decrypts a 64-bit block.

$mode should be either self::ENCRYPT or self::DECRYPT. See Feistel.png to get a general idea of what this function does.

See also
self::_encryptBlock()
self::_decryptBlock() @access private
Parameters
string$block
int$mode
Returns
string

Definition at line 676 of file DES.php.

677 {
678 static $sbox1, $sbox2, $sbox3, $sbox4, $sbox5, $sbox6, $sbox7, $sbox8, $shuffleip, $shuffleinvip;
679 if (!$sbox1) {
680 $sbox1 = array_map("intval", $this->sbox1);
681 $sbox2 = array_map("intval", $this->sbox2);
682 $sbox3 = array_map("intval", $this->sbox3);
683 $sbox4 = array_map("intval", $this->sbox4);
684 $sbox5 = array_map("intval", $this->sbox5);
685 $sbox6 = array_map("intval", $this->sbox6);
686 $sbox7 = array_map("intval", $this->sbox7);
687 $sbox8 = array_map("intval", $this->sbox8);
688 /* Merge $shuffle with $[inv]ipmap */
689 for ($i = 0; $i < 256; ++$i) {
690 $shuffleip[] = $this->shuffle[$this->ipmap[$i]];
691 $shuffleinvip[] = $this->shuffle[$this->invipmap[$i]];
692 }
693 }
694
695 $keys = $this->keys[$mode];
696 $ki = -1;
697
698 // Do the initial IP permutation.
699 $t = unpack('Nl/Nr', $block);
700 list($l, $r) = array($t['l'], $t['r']);
701 $block = ($shuffleip[ $r & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
702 ($shuffleip[($r >> 8) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
703 ($shuffleip[($r >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
704 ($shuffleip[($r >> 24) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
705 ($shuffleip[ $l & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
706 ($shuffleip[($l >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
707 ($shuffleip[($l >> 16) & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
708 ($shuffleip[($l >> 24) & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01");
709
710 // Extract L0 and R0.
711 $t = unpack('Nl/Nr', $block);
712 list($l, $r) = array($t['l'], $t['r']);
713
714 for ($des_round = 0; $des_round < $this->des_rounds; ++$des_round) {
715 // Perform the 16 steps.
716 for ($i = 0; $i < 16; $i++) {
717 // start of "the Feistel (F) function" - see the following URL:
718 // http://en.wikipedia.org/wiki/Image:Data_Encryption_Standard_InfoBox_Diagram.png
719 // Merge key schedule.
720 $b1 = (($r >> 3) & 0x1FFFFFFF) ^ ($r << 29) ^ $keys[++$ki];
721 $b2 = (($r >> 31) & 0x00000001) ^ ($r << 1) ^ $keys[++$ki];
722
723 // S-box indexing.
724 $t = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^
725 $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^
726 $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^
727 $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ $l;
728 // end of "the Feistel (F) function"
729
730 $l = $r;
731 $r = $t;
732 }
733
734 // Last step should not permute L & R.
735 $t = $l;
736 $l = $r;
737 $r = $t;
738 }
739
740 // Perform the inverse IP permutation.
741 return ($shuffleinvip[($r >> 24) & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
742 ($shuffleinvip[($l >> 24) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
743 ($shuffleinvip[($r >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
744 ($shuffleinvip[($l >> 16) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
745 ($shuffleinvip[($r >> 8) & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
746 ($shuffleinvip[($l >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
747 ($shuffleinvip[ $r & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
748 ($shuffleinvip[ $l & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01");
749 }
global $l
Definition: afr.php:30
$i
Definition: disco.tpl.php:19
$r
Definition: example_031.php:79

References phpseclib\Crypt\DES\$des_rounds, $i, phpseclib\Crypt\DES\$keys, $l, phpseclib\Crypt\Base\$mode, $r, phpseclib\Crypt\DES\$sbox1, phpseclib\Crypt\DES\$sbox2, phpseclib\Crypt\DES\$sbox3, phpseclib\Crypt\DES\$sbox4, phpseclib\Crypt\DES\$sbox5, phpseclib\Crypt\DES\$sbox6, phpseclib\Crypt\DES\$sbox7, phpseclib\Crypt\DES\$sbox8, and $t.

Referenced by phpseclib\Crypt\DES\_decryptBlock(), and phpseclib\Crypt\DES\_encryptBlock().

+ Here is the caller graph for this function:

◆ _setupInlineCrypt()

phpseclib\Crypt\DES::_setupInlineCrypt ( )

Setup the performance-optimized function for de/encrypt()

See also
\phpseclib\Crypt\Base::_setupInlineCrypt() @access private

Reimplemented from phpseclib\Crypt\Base.

Definition at line 1292 of file DES.php.

1293 {
1294 $lambda_functions =& self::_getLambdaFunctions();
1295
1296 // Engine configuration for:
1297 // - DES ($des_rounds == 1) or
1298 // - 3DES ($des_rounds == 3)
1300
1301 // We create max. 10 hi-optimized code for memory reason. Means: For each $key one ultra fast inline-crypt function.
1302 // (Currently, for DES, one generated $lambda_function cost on php5.5@32bit ~135kb unfreeable mem and ~230kb on php5.5@64bit)
1303 // (Currently, for TripleDES, one generated $lambda_function cost on php5.5@32bit ~240kb unfreeable mem and ~340kb on php5.5@64bit)
1304 // After that, we'll still create very fast optimized code but not the hi-ultimative code, for each $mode one
1305 $gen_hi_opt_code = (bool)( count($lambda_functions) < 10 );
1306
1307 // Generation of a uniqe hash for our generated code
1308 $code_hash = "Crypt_DES, $des_rounds, {$this->mode}";
1309 if ($gen_hi_opt_code) {
1310 // For hi-optimized code, we create for each combination of
1311 // $mode, $des_rounds and $this->key its own encrypt/decrypt function.
1312 // After max 10 hi-optimized functions, we create generic
1313 // (still very fast.. but not ultra) functions for each $mode/$des_rounds
1314 // Currently 2 * 5 generic functions will be then max. possible.
1315 $code_hash = str_pad($code_hash, 32) . $this->_hashInlineCryptFunction($this->key);
1316 }
1317
1318 // Is there a re-usable $lambda_functions in there? If not, we have to create it.
1319 if (!isset($lambda_functions[$code_hash])) {
1320 // Init code for both, encrypt and decrypt.
1321 $init_crypt = 'static $sbox1, $sbox2, $sbox3, $sbox4, $sbox5, $sbox6, $sbox7, $sbox8, $shuffleip, $shuffleinvip;
1322 if (!$sbox1) {
1323 $sbox1 = array_map("intval", $self->sbox1);
1324 $sbox2 = array_map("intval", $self->sbox2);
1325 $sbox3 = array_map("intval", $self->sbox3);
1326 $sbox4 = array_map("intval", $self->sbox4);
1327 $sbox5 = array_map("intval", $self->sbox5);
1328 $sbox6 = array_map("intval", $self->sbox6);
1329 $sbox7 = array_map("intval", $self->sbox7);
1330 $sbox8 = array_map("intval", $self->sbox8);'
1331 /* Merge $shuffle with $[inv]ipmap */ . '
1332 for ($i = 0; $i < 256; ++$i) {
1333 $shuffleip[] = $self->shuffle[$self->ipmap[$i]];
1334 $shuffleinvip[] = $self->shuffle[$self->invipmap[$i]];
1335 }
1336 }
1337 ';
1338
1339 switch (true) {
1340 case $gen_hi_opt_code:
1341 // In Hi-optimized code mode, we use our [3]DES key schedule as hardcoded integers.
1342 // No futher initialisation of the $keys schedule is necessary.
1343 // That is the extra performance boost.
1344 $k = array(
1345 self::ENCRYPT => $this->keys[self::ENCRYPT],
1346 self::DECRYPT => $this->keys[self::DECRYPT]
1347 );
1348 $init_encrypt = '';
1349 $init_decrypt = '';
1350 break;
1351 default:
1352 // In generic optimized code mode, we have to use, as the best compromise [currently],
1353 // our key schedule as $ke/$kd arrays. (with hardcoded indexes...)
1354 $k = array(
1355 self::ENCRYPT => array(),
1356 self::DECRYPT => array()
1357 );
1358 for ($i = 0, $c = count($this->keys[self::ENCRYPT]); $i < $c; ++$i) {
1359 $k[self::ENCRYPT][$i] = '$ke[' . $i . ']';
1360 $k[self::DECRYPT][$i] = '$kd[' . $i . ']';
1361 }
1362 $init_encrypt = '$ke = $self->keys[self::ENCRYPT];';
1363 $init_decrypt = '$kd = $self->keys[self::DECRYPT];';
1364 break;
1365 }
1366
1367 // Creating code for en- and decryption.
1368 $crypt_block = array();
1369 foreach (array(self::ENCRYPT, self::DECRYPT) as $c) {
1370 /* Do the initial IP permutation. */
1371 $crypt_block[$c] = '
1372 $in = unpack("N*", $in);
1373 $l = $in[1];
1374 $r = $in[2];
1375 $in = unpack("N*",
1376 ($shuffleip[ $r & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
1377 ($shuffleip[($r >> 8) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
1378 ($shuffleip[($r >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
1379 ($shuffleip[($r >> 24) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
1380 ($shuffleip[ $l & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
1381 ($shuffleip[($l >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
1382 ($shuffleip[($l >> 16) & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
1383 ($shuffleip[($l >> 24) & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01")
1384 );
1385 ' . /* Extract L0 and R0 */ '
1386 $l = $in[1];
1387 $r = $in[2];
1388 ';
1389
1390 $l = '$l';
1391 $r = '$r';
1392
1393 // Perform DES or 3DES.
1394 for ($ki = -1, $des_round = 0; $des_round < $des_rounds; ++$des_round) {
1395 // Perform the 16 steps.
1396 for ($i = 0; $i < 16; ++$i) {
1397 // start of "the Feistel (F) function" - see the following URL:
1398 // http://en.wikipedia.org/wiki/Image:Data_Encryption_Standard_InfoBox_Diagram.png
1399 // Merge key schedule.
1400 $crypt_block[$c].= '
1401 $b1 = ((' . $r . ' >> 3) & 0x1FFFFFFF) ^ (' . $r . ' << 29) ^ ' . $k[$c][++$ki] . ';
1402 $b2 = ((' . $r . ' >> 31) & 0x00000001) ^ (' . $r . ' << 1) ^ ' . $k[$c][++$ki] . ';' .
1403 /* S-box indexing. */
1404 $l . ' = $sbox1[($b1 >> 24) & 0x3F] ^ $sbox2[($b2 >> 24) & 0x3F] ^
1405 $sbox3[($b1 >> 16) & 0x3F] ^ $sbox4[($b2 >> 16) & 0x3F] ^
1406 $sbox5[($b1 >> 8) & 0x3F] ^ $sbox6[($b2 >> 8) & 0x3F] ^
1407 $sbox7[ $b1 & 0x3F] ^ $sbox8[ $b2 & 0x3F] ^ ' . $l . ';
1408 ';
1409 // end of "the Feistel (F) function"
1410
1411 // swap L & R
1412 list($l, $r) = array($r, $l);
1413 }
1414 list($l, $r) = array($r, $l);
1415 }
1416
1417 // Perform the inverse IP permutation.
1418 $crypt_block[$c].= '$in =
1419 ($shuffleinvip[($l >> 24) & 0xFF] & "\x80\x80\x80\x80\x80\x80\x80\x80") |
1420 ($shuffleinvip[($r >> 24) & 0xFF] & "\x40\x40\x40\x40\x40\x40\x40\x40") |
1421 ($shuffleinvip[($l >> 16) & 0xFF] & "\x20\x20\x20\x20\x20\x20\x20\x20") |
1422 ($shuffleinvip[($r >> 16) & 0xFF] & "\x10\x10\x10\x10\x10\x10\x10\x10") |
1423 ($shuffleinvip[($l >> 8) & 0xFF] & "\x08\x08\x08\x08\x08\x08\x08\x08") |
1424 ($shuffleinvip[($r >> 8) & 0xFF] & "\x04\x04\x04\x04\x04\x04\x04\x04") |
1425 ($shuffleinvip[ $l & 0xFF] & "\x02\x02\x02\x02\x02\x02\x02\x02") |
1426 ($shuffleinvip[ $r & 0xFF] & "\x01\x01\x01\x01\x01\x01\x01\x01");
1427 ';
1428 }
1429
1430 // Creates the inline-crypt function
1431 $lambda_functions[$code_hash] = $this->_createInlineCryptFunction(
1432 array(
1433 'init_crypt' => $init_crypt,
1434 'init_encrypt' => $init_encrypt,
1435 'init_decrypt' => $init_decrypt,
1436 'encrypt_block' => $crypt_block[self::ENCRYPT],
1437 'decrypt_block' => $crypt_block[self::DECRYPT]
1438 )
1439 );
1440 }
1441
1442 // Set the inline-crypt function as callback in: $this->inline_crypt
1443 $this->inline_crypt = $lambda_functions[$code_hash];
1444 }
_hashInlineCryptFunction($bytes)
Generates a digest from $bytes.
Definition: Base.php:2523
& _getLambdaFunctions()
Holds the lambda_functions table (classwide)
Definition: Base.php:2509
_createInlineCryptFunction($cipher_code)
Creates the performance-optimized function for en/decrypt()
Definition: Base.php:2142
const ENCRYPT
#+ @access private
Definition: DES.php:64
const DECRYPT
Contains $keys[self::DECRYPT].
Definition: DES.php:68

References $c, phpseclib\Crypt\DES\$des_rounds, $i, $l, $r, phpseclib\Crypt\Base\_createInlineCryptFunction(), phpseclib\Crypt\Base\_getLambdaFunctions(), phpseclib\Crypt\Base\_hashInlineCryptFunction(), phpseclib\Crypt\DES\DECRYPT, and phpseclib\Crypt\DES\ENCRYPT.

+ Here is the call graph for this function:

◆ _setupKey()

phpseclib\Crypt\DES::_setupKey ( )

Creates the key schedule.

See also
\phpseclib\Crypt\Base::_setupKey() @access private

Reimplemented from phpseclib\Crypt\Base.

Reimplemented in phpseclib\Crypt\TripleDES.

Definition at line 757 of file DES.php.

758 {
759 if (isset($this->kl['key']) && $this->key === $this->kl['key'] && $this->des_rounds === $this->kl['des_rounds']) {
760 // already expanded
761 return;
762 }
763 $this->kl = array('key' => $this->key, 'des_rounds' => $this->des_rounds);
764
765 static $shifts = array( // number of key bits shifted per round
766 1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
767 );
768
769 static $pc1map = array(
770 0x00, 0x00, 0x08, 0x08, 0x04, 0x04, 0x0C, 0x0C,
771 0x02, 0x02, 0x0A, 0x0A, 0x06, 0x06, 0x0E, 0x0E,
772 0x10, 0x10, 0x18, 0x18, 0x14, 0x14, 0x1C, 0x1C,
773 0x12, 0x12, 0x1A, 0x1A, 0x16, 0x16, 0x1E, 0x1E,
774 0x20, 0x20, 0x28, 0x28, 0x24, 0x24, 0x2C, 0x2C,
775 0x22, 0x22, 0x2A, 0x2A, 0x26, 0x26, 0x2E, 0x2E,
776 0x30, 0x30, 0x38, 0x38, 0x34, 0x34, 0x3C, 0x3C,
777 0x32, 0x32, 0x3A, 0x3A, 0x36, 0x36, 0x3E, 0x3E,
778 0x40, 0x40, 0x48, 0x48, 0x44, 0x44, 0x4C, 0x4C,
779 0x42, 0x42, 0x4A, 0x4A, 0x46, 0x46, 0x4E, 0x4E,
780 0x50, 0x50, 0x58, 0x58, 0x54, 0x54, 0x5C, 0x5C,
781 0x52, 0x52, 0x5A, 0x5A, 0x56, 0x56, 0x5E, 0x5E,
782 0x60, 0x60, 0x68, 0x68, 0x64, 0x64, 0x6C, 0x6C,
783 0x62, 0x62, 0x6A, 0x6A, 0x66, 0x66, 0x6E, 0x6E,
784 0x70, 0x70, 0x78, 0x78, 0x74, 0x74, 0x7C, 0x7C,
785 0x72, 0x72, 0x7A, 0x7A, 0x76, 0x76, 0x7E, 0x7E,
786 0x80, 0x80, 0x88, 0x88, 0x84, 0x84, 0x8C, 0x8C,
787 0x82, 0x82, 0x8A, 0x8A, 0x86, 0x86, 0x8E, 0x8E,
788 0x90, 0x90, 0x98, 0x98, 0x94, 0x94, 0x9C, 0x9C,
789 0x92, 0x92, 0x9A, 0x9A, 0x96, 0x96, 0x9E, 0x9E,
790 0xA0, 0xA0, 0xA8, 0xA8, 0xA4, 0xA4, 0xAC, 0xAC,
791 0xA2, 0xA2, 0xAA, 0xAA, 0xA6, 0xA6, 0xAE, 0xAE,
792 0xB0, 0xB0, 0xB8, 0xB8, 0xB4, 0xB4, 0xBC, 0xBC,
793 0xB2, 0xB2, 0xBA, 0xBA, 0xB6, 0xB6, 0xBE, 0xBE,
794 0xC0, 0xC0, 0xC8, 0xC8, 0xC4, 0xC4, 0xCC, 0xCC,
795 0xC2, 0xC2, 0xCA, 0xCA, 0xC6, 0xC6, 0xCE, 0xCE,
796 0xD0, 0xD0, 0xD8, 0xD8, 0xD4, 0xD4, 0xDC, 0xDC,
797 0xD2, 0xD2, 0xDA, 0xDA, 0xD6, 0xD6, 0xDE, 0xDE,
798 0xE0, 0xE0, 0xE8, 0xE8, 0xE4, 0xE4, 0xEC, 0xEC,
799 0xE2, 0xE2, 0xEA, 0xEA, 0xE6, 0xE6, 0xEE, 0xEE,
800 0xF0, 0xF0, 0xF8, 0xF8, 0xF4, 0xF4, 0xFC, 0xFC,
801 0xF2, 0xF2, 0xFA, 0xFA, 0xF6, 0xF6, 0xFE, 0xFE
802 );
803
804 // Mapping tables for the PC-2 transformation.
805 static $pc2mapc1 = array(
806 0x00000000, 0x00000400, 0x00200000, 0x00200400,
807 0x00000001, 0x00000401, 0x00200001, 0x00200401,
808 0x02000000, 0x02000400, 0x02200000, 0x02200400,
809 0x02000001, 0x02000401, 0x02200001, 0x02200401
810 );
811 static $pc2mapc2 = array(
812 0x00000000, 0x00000800, 0x08000000, 0x08000800,
813 0x00010000, 0x00010800, 0x08010000, 0x08010800,
814 0x00000000, 0x00000800, 0x08000000, 0x08000800,
815 0x00010000, 0x00010800, 0x08010000, 0x08010800,
816 0x00000100, 0x00000900, 0x08000100, 0x08000900,
817 0x00010100, 0x00010900, 0x08010100, 0x08010900,
818 0x00000100, 0x00000900, 0x08000100, 0x08000900,
819 0x00010100, 0x00010900, 0x08010100, 0x08010900,
820 0x00000010, 0x00000810, 0x08000010, 0x08000810,
821 0x00010010, 0x00010810, 0x08010010, 0x08010810,
822 0x00000010, 0x00000810, 0x08000010, 0x08000810,
823 0x00010010, 0x00010810, 0x08010010, 0x08010810,
824 0x00000110, 0x00000910, 0x08000110, 0x08000910,
825 0x00010110, 0x00010910, 0x08010110, 0x08010910,
826 0x00000110, 0x00000910, 0x08000110, 0x08000910,
827 0x00010110, 0x00010910, 0x08010110, 0x08010910,
828 0x00040000, 0x00040800, 0x08040000, 0x08040800,
829 0x00050000, 0x00050800, 0x08050000, 0x08050800,
830 0x00040000, 0x00040800, 0x08040000, 0x08040800,
831 0x00050000, 0x00050800, 0x08050000, 0x08050800,
832 0x00040100, 0x00040900, 0x08040100, 0x08040900,
833 0x00050100, 0x00050900, 0x08050100, 0x08050900,
834 0x00040100, 0x00040900, 0x08040100, 0x08040900,
835 0x00050100, 0x00050900, 0x08050100, 0x08050900,
836 0x00040010, 0x00040810, 0x08040010, 0x08040810,
837 0x00050010, 0x00050810, 0x08050010, 0x08050810,
838 0x00040010, 0x00040810, 0x08040010, 0x08040810,
839 0x00050010, 0x00050810, 0x08050010, 0x08050810,
840 0x00040110, 0x00040910, 0x08040110, 0x08040910,
841 0x00050110, 0x00050910, 0x08050110, 0x08050910,
842 0x00040110, 0x00040910, 0x08040110, 0x08040910,
843 0x00050110, 0x00050910, 0x08050110, 0x08050910,
844 0x01000000, 0x01000800, 0x09000000, 0x09000800,
845 0x01010000, 0x01010800, 0x09010000, 0x09010800,
846 0x01000000, 0x01000800, 0x09000000, 0x09000800,
847 0x01010000, 0x01010800, 0x09010000, 0x09010800,
848 0x01000100, 0x01000900, 0x09000100, 0x09000900,
849 0x01010100, 0x01010900, 0x09010100, 0x09010900,
850 0x01000100, 0x01000900, 0x09000100, 0x09000900,
851 0x01010100, 0x01010900, 0x09010100, 0x09010900,
852 0x01000010, 0x01000810, 0x09000010, 0x09000810,
853 0x01010010, 0x01010810, 0x09010010, 0x09010810,
854 0x01000010, 0x01000810, 0x09000010, 0x09000810,
855 0x01010010, 0x01010810, 0x09010010, 0x09010810,
856 0x01000110, 0x01000910, 0x09000110, 0x09000910,
857 0x01010110, 0x01010910, 0x09010110, 0x09010910,
858 0x01000110, 0x01000910, 0x09000110, 0x09000910,
859 0x01010110, 0x01010910, 0x09010110, 0x09010910,
860 0x01040000, 0x01040800, 0x09040000, 0x09040800,
861 0x01050000, 0x01050800, 0x09050000, 0x09050800,
862 0x01040000, 0x01040800, 0x09040000, 0x09040800,
863 0x01050000, 0x01050800, 0x09050000, 0x09050800,
864 0x01040100, 0x01040900, 0x09040100, 0x09040900,
865 0x01050100, 0x01050900, 0x09050100, 0x09050900,
866 0x01040100, 0x01040900, 0x09040100, 0x09040900,
867 0x01050100, 0x01050900, 0x09050100, 0x09050900,
868 0x01040010, 0x01040810, 0x09040010, 0x09040810,
869 0x01050010, 0x01050810, 0x09050010, 0x09050810,
870 0x01040010, 0x01040810, 0x09040010, 0x09040810,
871 0x01050010, 0x01050810, 0x09050010, 0x09050810,
872 0x01040110, 0x01040910, 0x09040110, 0x09040910,
873 0x01050110, 0x01050910, 0x09050110, 0x09050910,
874 0x01040110, 0x01040910, 0x09040110, 0x09040910,
875 0x01050110, 0x01050910, 0x09050110, 0x09050910
876 );
877 static $pc2mapc3 = array(
878 0x00000000, 0x00000004, 0x00001000, 0x00001004,
879 0x00000000, 0x00000004, 0x00001000, 0x00001004,
880 0x10000000, 0x10000004, 0x10001000, 0x10001004,
881 0x10000000, 0x10000004, 0x10001000, 0x10001004,
882 0x00000020, 0x00000024, 0x00001020, 0x00001024,
883 0x00000020, 0x00000024, 0x00001020, 0x00001024,
884 0x10000020, 0x10000024, 0x10001020, 0x10001024,
885 0x10000020, 0x10000024, 0x10001020, 0x10001024,
886 0x00080000, 0x00080004, 0x00081000, 0x00081004,
887 0x00080000, 0x00080004, 0x00081000, 0x00081004,
888 0x10080000, 0x10080004, 0x10081000, 0x10081004,
889 0x10080000, 0x10080004, 0x10081000, 0x10081004,
890 0x00080020, 0x00080024, 0x00081020, 0x00081024,
891 0x00080020, 0x00080024, 0x00081020, 0x00081024,
892 0x10080020, 0x10080024, 0x10081020, 0x10081024,
893 0x10080020, 0x10080024, 0x10081020, 0x10081024,
894 0x20000000, 0x20000004, 0x20001000, 0x20001004,
895 0x20000000, 0x20000004, 0x20001000, 0x20001004,
896 0x30000000, 0x30000004, 0x30001000, 0x30001004,
897 0x30000000, 0x30000004, 0x30001000, 0x30001004,
898 0x20000020, 0x20000024, 0x20001020, 0x20001024,
899 0x20000020, 0x20000024, 0x20001020, 0x20001024,
900 0x30000020, 0x30000024, 0x30001020, 0x30001024,
901 0x30000020, 0x30000024, 0x30001020, 0x30001024,
902 0x20080000, 0x20080004, 0x20081000, 0x20081004,
903 0x20080000, 0x20080004, 0x20081000, 0x20081004,
904 0x30080000, 0x30080004, 0x30081000, 0x30081004,
905 0x30080000, 0x30080004, 0x30081000, 0x30081004,
906 0x20080020, 0x20080024, 0x20081020, 0x20081024,
907 0x20080020, 0x20080024, 0x20081020, 0x20081024,
908 0x30080020, 0x30080024, 0x30081020, 0x30081024,
909 0x30080020, 0x30080024, 0x30081020, 0x30081024,
910 0x00000002, 0x00000006, 0x00001002, 0x00001006,
911 0x00000002, 0x00000006, 0x00001002, 0x00001006,
912 0x10000002, 0x10000006, 0x10001002, 0x10001006,
913 0x10000002, 0x10000006, 0x10001002, 0x10001006,
914 0x00000022, 0x00000026, 0x00001022, 0x00001026,
915 0x00000022, 0x00000026, 0x00001022, 0x00001026,
916 0x10000022, 0x10000026, 0x10001022, 0x10001026,
917 0x10000022, 0x10000026, 0x10001022, 0x10001026,
918 0x00080002, 0x00080006, 0x00081002, 0x00081006,
919 0x00080002, 0x00080006, 0x00081002, 0x00081006,
920 0x10080002, 0x10080006, 0x10081002, 0x10081006,
921 0x10080002, 0x10080006, 0x10081002, 0x10081006,
922 0x00080022, 0x00080026, 0x00081022, 0x00081026,
923 0x00080022, 0x00080026, 0x00081022, 0x00081026,
924 0x10080022, 0x10080026, 0x10081022, 0x10081026,
925 0x10080022, 0x10080026, 0x10081022, 0x10081026,
926 0x20000002, 0x20000006, 0x20001002, 0x20001006,
927 0x20000002, 0x20000006, 0x20001002, 0x20001006,
928 0x30000002, 0x30000006, 0x30001002, 0x30001006,
929 0x30000002, 0x30000006, 0x30001002, 0x30001006,
930 0x20000022, 0x20000026, 0x20001022, 0x20001026,
931 0x20000022, 0x20000026, 0x20001022, 0x20001026,
932 0x30000022, 0x30000026, 0x30001022, 0x30001026,
933 0x30000022, 0x30000026, 0x30001022, 0x30001026,
934 0x20080002, 0x20080006, 0x20081002, 0x20081006,
935 0x20080002, 0x20080006, 0x20081002, 0x20081006,
936 0x30080002, 0x30080006, 0x30081002, 0x30081006,
937 0x30080002, 0x30080006, 0x30081002, 0x30081006,
938 0x20080022, 0x20080026, 0x20081022, 0x20081026,
939 0x20080022, 0x20080026, 0x20081022, 0x20081026,
940 0x30080022, 0x30080026, 0x30081022, 0x30081026,
941 0x30080022, 0x30080026, 0x30081022, 0x30081026
942 );
943 static $pc2mapc4 = array(
944 0x00000000, 0x00100000, 0x00000008, 0x00100008,
945 0x00000200, 0x00100200, 0x00000208, 0x00100208,
946 0x00000000, 0x00100000, 0x00000008, 0x00100008,
947 0x00000200, 0x00100200, 0x00000208, 0x00100208,
948 0x04000000, 0x04100000, 0x04000008, 0x04100008,
949 0x04000200, 0x04100200, 0x04000208, 0x04100208,
950 0x04000000, 0x04100000, 0x04000008, 0x04100008,
951 0x04000200, 0x04100200, 0x04000208, 0x04100208,
952 0x00002000, 0x00102000, 0x00002008, 0x00102008,
953 0x00002200, 0x00102200, 0x00002208, 0x00102208,
954 0x00002000, 0x00102000, 0x00002008, 0x00102008,
955 0x00002200, 0x00102200, 0x00002208, 0x00102208,
956 0x04002000, 0x04102000, 0x04002008, 0x04102008,
957 0x04002200, 0x04102200, 0x04002208, 0x04102208,
958 0x04002000, 0x04102000, 0x04002008, 0x04102008,
959 0x04002200, 0x04102200, 0x04002208, 0x04102208,
960 0x00000000, 0x00100000, 0x00000008, 0x00100008,
961 0x00000200, 0x00100200, 0x00000208, 0x00100208,
962 0x00000000, 0x00100000, 0x00000008, 0x00100008,
963 0x00000200, 0x00100200, 0x00000208, 0x00100208,
964 0x04000000, 0x04100000, 0x04000008, 0x04100008,
965 0x04000200, 0x04100200, 0x04000208, 0x04100208,
966 0x04000000, 0x04100000, 0x04000008, 0x04100008,
967 0x04000200, 0x04100200, 0x04000208, 0x04100208,
968 0x00002000, 0x00102000, 0x00002008, 0x00102008,
969 0x00002200, 0x00102200, 0x00002208, 0x00102208,
970 0x00002000, 0x00102000, 0x00002008, 0x00102008,
971 0x00002200, 0x00102200, 0x00002208, 0x00102208,
972 0x04002000, 0x04102000, 0x04002008, 0x04102008,
973 0x04002200, 0x04102200, 0x04002208, 0x04102208,
974 0x04002000, 0x04102000, 0x04002008, 0x04102008,
975 0x04002200, 0x04102200, 0x04002208, 0x04102208,
976 0x00020000, 0x00120000, 0x00020008, 0x00120008,
977 0x00020200, 0x00120200, 0x00020208, 0x00120208,
978 0x00020000, 0x00120000, 0x00020008, 0x00120008,
979 0x00020200, 0x00120200, 0x00020208, 0x00120208,
980 0x04020000, 0x04120000, 0x04020008, 0x04120008,
981 0x04020200, 0x04120200, 0x04020208, 0x04120208,
982 0x04020000, 0x04120000, 0x04020008, 0x04120008,
983 0x04020200, 0x04120200, 0x04020208, 0x04120208,
984 0x00022000, 0x00122000, 0x00022008, 0x00122008,
985 0x00022200, 0x00122200, 0x00022208, 0x00122208,
986 0x00022000, 0x00122000, 0x00022008, 0x00122008,
987 0x00022200, 0x00122200, 0x00022208, 0x00122208,
988 0x04022000, 0x04122000, 0x04022008, 0x04122008,
989 0x04022200, 0x04122200, 0x04022208, 0x04122208,
990 0x04022000, 0x04122000, 0x04022008, 0x04122008,
991 0x04022200, 0x04122200, 0x04022208, 0x04122208,
992 0x00020000, 0x00120000, 0x00020008, 0x00120008,
993 0x00020200, 0x00120200, 0x00020208, 0x00120208,
994 0x00020000, 0x00120000, 0x00020008, 0x00120008,
995 0x00020200, 0x00120200, 0x00020208, 0x00120208,
996 0x04020000, 0x04120000, 0x04020008, 0x04120008,
997 0x04020200, 0x04120200, 0x04020208, 0x04120208,
998 0x04020000, 0x04120000, 0x04020008, 0x04120008,
999 0x04020200, 0x04120200, 0x04020208, 0x04120208,
1000 0x00022000, 0x00122000, 0x00022008, 0x00122008,
1001 0x00022200, 0x00122200, 0x00022208, 0x00122208,
1002 0x00022000, 0x00122000, 0x00022008, 0x00122008,
1003 0x00022200, 0x00122200, 0x00022208, 0x00122208,
1004 0x04022000, 0x04122000, 0x04022008, 0x04122008,
1005 0x04022200, 0x04122200, 0x04022208, 0x04122208,
1006 0x04022000, 0x04122000, 0x04022008, 0x04122008,
1007 0x04022200, 0x04122200, 0x04022208, 0x04122208
1008 );
1009 static $pc2mapd1 = array(
1010 0x00000000, 0x00000001, 0x08000000, 0x08000001,
1011 0x00200000, 0x00200001, 0x08200000, 0x08200001,
1012 0x00000002, 0x00000003, 0x08000002, 0x08000003,
1013 0x00200002, 0x00200003, 0x08200002, 0x08200003
1014 );
1015 static $pc2mapd2 = array(
1016 0x00000000, 0x00100000, 0x00000800, 0x00100800,
1017 0x00000000, 0x00100000, 0x00000800, 0x00100800,
1018 0x04000000, 0x04100000, 0x04000800, 0x04100800,
1019 0x04000000, 0x04100000, 0x04000800, 0x04100800,
1020 0x00000004, 0x00100004, 0x00000804, 0x00100804,
1021 0x00000004, 0x00100004, 0x00000804, 0x00100804,
1022 0x04000004, 0x04100004, 0x04000804, 0x04100804,
1023 0x04000004, 0x04100004, 0x04000804, 0x04100804,
1024 0x00000000, 0x00100000, 0x00000800, 0x00100800,
1025 0x00000000, 0x00100000, 0x00000800, 0x00100800,
1026 0x04000000, 0x04100000, 0x04000800, 0x04100800,
1027 0x04000000, 0x04100000, 0x04000800, 0x04100800,
1028 0x00000004, 0x00100004, 0x00000804, 0x00100804,
1029 0x00000004, 0x00100004, 0x00000804, 0x00100804,
1030 0x04000004, 0x04100004, 0x04000804, 0x04100804,
1031 0x04000004, 0x04100004, 0x04000804, 0x04100804,
1032 0x00000200, 0x00100200, 0x00000A00, 0x00100A00,
1033 0x00000200, 0x00100200, 0x00000A00, 0x00100A00,
1034 0x04000200, 0x04100200, 0x04000A00, 0x04100A00,
1035 0x04000200, 0x04100200, 0x04000A00, 0x04100A00,
1036 0x00000204, 0x00100204, 0x00000A04, 0x00100A04,
1037 0x00000204, 0x00100204, 0x00000A04, 0x00100A04,
1038 0x04000204, 0x04100204, 0x04000A04, 0x04100A04,
1039 0x04000204, 0x04100204, 0x04000A04, 0x04100A04,
1040 0x00000200, 0x00100200, 0x00000A00, 0x00100A00,
1041 0x00000200, 0x00100200, 0x00000A00, 0x00100A00,
1042 0x04000200, 0x04100200, 0x04000A00, 0x04100A00,
1043 0x04000200, 0x04100200, 0x04000A00, 0x04100A00,
1044 0x00000204, 0x00100204, 0x00000A04, 0x00100A04,
1045 0x00000204, 0x00100204, 0x00000A04, 0x00100A04,
1046 0x04000204, 0x04100204, 0x04000A04, 0x04100A04,
1047 0x04000204, 0x04100204, 0x04000A04, 0x04100A04,
1048 0x00020000, 0x00120000, 0x00020800, 0x00120800,
1049 0x00020000, 0x00120000, 0x00020800, 0x00120800,
1050 0x04020000, 0x04120000, 0x04020800, 0x04120800,
1051 0x04020000, 0x04120000, 0x04020800, 0x04120800,
1052 0x00020004, 0x00120004, 0x00020804, 0x00120804,
1053 0x00020004, 0x00120004, 0x00020804, 0x00120804,
1054 0x04020004, 0x04120004, 0x04020804, 0x04120804,
1055 0x04020004, 0x04120004, 0x04020804, 0x04120804,
1056 0x00020000, 0x00120000, 0x00020800, 0x00120800,
1057 0x00020000, 0x00120000, 0x00020800, 0x00120800,
1058 0x04020000, 0x04120000, 0x04020800, 0x04120800,
1059 0x04020000, 0x04120000, 0x04020800, 0x04120800,
1060 0x00020004, 0x00120004, 0x00020804, 0x00120804,
1061 0x00020004, 0x00120004, 0x00020804, 0x00120804,
1062 0x04020004, 0x04120004, 0x04020804, 0x04120804,
1063 0x04020004, 0x04120004, 0x04020804, 0x04120804,
1064 0x00020200, 0x00120200, 0x00020A00, 0x00120A00,
1065 0x00020200, 0x00120200, 0x00020A00, 0x00120A00,
1066 0x04020200, 0x04120200, 0x04020A00, 0x04120A00,
1067 0x04020200, 0x04120200, 0x04020A00, 0x04120A00,
1068 0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
1069 0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
1070 0x04020204, 0x04120204, 0x04020A04, 0x04120A04,
1071 0x04020204, 0x04120204, 0x04020A04, 0x04120A04,
1072 0x00020200, 0x00120200, 0x00020A00, 0x00120A00,
1073 0x00020200, 0x00120200, 0x00020A00, 0x00120A00,
1074 0x04020200, 0x04120200, 0x04020A00, 0x04120A00,
1075 0x04020200, 0x04120200, 0x04020A00, 0x04120A00,
1076 0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
1077 0x00020204, 0x00120204, 0x00020A04, 0x00120A04,
1078 0x04020204, 0x04120204, 0x04020A04, 0x04120A04,
1079 0x04020204, 0x04120204, 0x04020A04, 0x04120A04
1080 );
1081 static $pc2mapd3 = array(
1082 0x00000000, 0x00010000, 0x02000000, 0x02010000,
1083 0x00000020, 0x00010020, 0x02000020, 0x02010020,
1084 0x00040000, 0x00050000, 0x02040000, 0x02050000,
1085 0x00040020, 0x00050020, 0x02040020, 0x02050020,
1086 0x00002000, 0x00012000, 0x02002000, 0x02012000,
1087 0x00002020, 0x00012020, 0x02002020, 0x02012020,
1088 0x00042000, 0x00052000, 0x02042000, 0x02052000,
1089 0x00042020, 0x00052020, 0x02042020, 0x02052020,
1090 0x00000000, 0x00010000, 0x02000000, 0x02010000,
1091 0x00000020, 0x00010020, 0x02000020, 0x02010020,
1092 0x00040000, 0x00050000, 0x02040000, 0x02050000,
1093 0x00040020, 0x00050020, 0x02040020, 0x02050020,
1094 0x00002000, 0x00012000, 0x02002000, 0x02012000,
1095 0x00002020, 0x00012020, 0x02002020, 0x02012020,
1096 0x00042000, 0x00052000, 0x02042000, 0x02052000,
1097 0x00042020, 0x00052020, 0x02042020, 0x02052020,
1098 0x00000010, 0x00010010, 0x02000010, 0x02010010,
1099 0x00000030, 0x00010030, 0x02000030, 0x02010030,
1100 0x00040010, 0x00050010, 0x02040010, 0x02050010,
1101 0x00040030, 0x00050030, 0x02040030, 0x02050030,
1102 0x00002010, 0x00012010, 0x02002010, 0x02012010,
1103 0x00002030, 0x00012030, 0x02002030, 0x02012030,
1104 0x00042010, 0x00052010, 0x02042010, 0x02052010,
1105 0x00042030, 0x00052030, 0x02042030, 0x02052030,
1106 0x00000010, 0x00010010, 0x02000010, 0x02010010,
1107 0x00000030, 0x00010030, 0x02000030, 0x02010030,
1108 0x00040010, 0x00050010, 0x02040010, 0x02050010,
1109 0x00040030, 0x00050030, 0x02040030, 0x02050030,
1110 0x00002010, 0x00012010, 0x02002010, 0x02012010,
1111 0x00002030, 0x00012030, 0x02002030, 0x02012030,
1112 0x00042010, 0x00052010, 0x02042010, 0x02052010,
1113 0x00042030, 0x00052030, 0x02042030, 0x02052030,
1114 0x20000000, 0x20010000, 0x22000000, 0x22010000,
1115 0x20000020, 0x20010020, 0x22000020, 0x22010020,
1116 0x20040000, 0x20050000, 0x22040000, 0x22050000,
1117 0x20040020, 0x20050020, 0x22040020, 0x22050020,
1118 0x20002000, 0x20012000, 0x22002000, 0x22012000,
1119 0x20002020, 0x20012020, 0x22002020, 0x22012020,
1120 0x20042000, 0x20052000, 0x22042000, 0x22052000,
1121 0x20042020, 0x20052020, 0x22042020, 0x22052020,
1122 0x20000000, 0x20010000, 0x22000000, 0x22010000,
1123 0x20000020, 0x20010020, 0x22000020, 0x22010020,
1124 0x20040000, 0x20050000, 0x22040000, 0x22050000,
1125 0x20040020, 0x20050020, 0x22040020, 0x22050020,
1126 0x20002000, 0x20012000, 0x22002000, 0x22012000,
1127 0x20002020, 0x20012020, 0x22002020, 0x22012020,
1128 0x20042000, 0x20052000, 0x22042000, 0x22052000,
1129 0x20042020, 0x20052020, 0x22042020, 0x22052020,
1130 0x20000010, 0x20010010, 0x22000010, 0x22010010,
1131 0x20000030, 0x20010030, 0x22000030, 0x22010030,
1132 0x20040010, 0x20050010, 0x22040010, 0x22050010,
1133 0x20040030, 0x20050030, 0x22040030, 0x22050030,
1134 0x20002010, 0x20012010, 0x22002010, 0x22012010,
1135 0x20002030, 0x20012030, 0x22002030, 0x22012030,
1136 0x20042010, 0x20052010, 0x22042010, 0x22052010,
1137 0x20042030, 0x20052030, 0x22042030, 0x22052030,
1138 0x20000010, 0x20010010, 0x22000010, 0x22010010,
1139 0x20000030, 0x20010030, 0x22000030, 0x22010030,
1140 0x20040010, 0x20050010, 0x22040010, 0x22050010,
1141 0x20040030, 0x20050030, 0x22040030, 0x22050030,
1142 0x20002010, 0x20012010, 0x22002010, 0x22012010,
1143 0x20002030, 0x20012030, 0x22002030, 0x22012030,
1144 0x20042010, 0x20052010, 0x22042010, 0x22052010,
1145 0x20042030, 0x20052030, 0x22042030, 0x22052030
1146 );
1147 static $pc2mapd4 = array(
1148 0x00000000, 0x00000400, 0x01000000, 0x01000400,
1149 0x00000000, 0x00000400, 0x01000000, 0x01000400,
1150 0x00000100, 0x00000500, 0x01000100, 0x01000500,
1151 0x00000100, 0x00000500, 0x01000100, 0x01000500,
1152 0x10000000, 0x10000400, 0x11000000, 0x11000400,
1153 0x10000000, 0x10000400, 0x11000000, 0x11000400,
1154 0x10000100, 0x10000500, 0x11000100, 0x11000500,
1155 0x10000100, 0x10000500, 0x11000100, 0x11000500,
1156 0x00080000, 0x00080400, 0x01080000, 0x01080400,
1157 0x00080000, 0x00080400, 0x01080000, 0x01080400,
1158 0x00080100, 0x00080500, 0x01080100, 0x01080500,
1159 0x00080100, 0x00080500, 0x01080100, 0x01080500,
1160 0x10080000, 0x10080400, 0x11080000, 0x11080400,
1161 0x10080000, 0x10080400, 0x11080000, 0x11080400,
1162 0x10080100, 0x10080500, 0x11080100, 0x11080500,
1163 0x10080100, 0x10080500, 0x11080100, 0x11080500,
1164 0x00000008, 0x00000408, 0x01000008, 0x01000408,
1165 0x00000008, 0x00000408, 0x01000008, 0x01000408,
1166 0x00000108, 0x00000508, 0x01000108, 0x01000508,
1167 0x00000108, 0x00000508, 0x01000108, 0x01000508,
1168 0x10000008, 0x10000408, 0x11000008, 0x11000408,
1169 0x10000008, 0x10000408, 0x11000008, 0x11000408,
1170 0x10000108, 0x10000508, 0x11000108, 0x11000508,
1171 0x10000108, 0x10000508, 0x11000108, 0x11000508,
1172 0x00080008, 0x00080408, 0x01080008, 0x01080408,
1173 0x00080008, 0x00080408, 0x01080008, 0x01080408,
1174 0x00080108, 0x00080508, 0x01080108, 0x01080508,
1175 0x00080108, 0x00080508, 0x01080108, 0x01080508,
1176 0x10080008, 0x10080408, 0x11080008, 0x11080408,
1177 0x10080008, 0x10080408, 0x11080008, 0x11080408,
1178 0x10080108, 0x10080508, 0x11080108, 0x11080508,
1179 0x10080108, 0x10080508, 0x11080108, 0x11080508,
1180 0x00001000, 0x00001400, 0x01001000, 0x01001400,
1181 0x00001000, 0x00001400, 0x01001000, 0x01001400,
1182 0x00001100, 0x00001500, 0x01001100, 0x01001500,
1183 0x00001100, 0x00001500, 0x01001100, 0x01001500,
1184 0x10001000, 0x10001400, 0x11001000, 0x11001400,
1185 0x10001000, 0x10001400, 0x11001000, 0x11001400,
1186 0x10001100, 0x10001500, 0x11001100, 0x11001500,
1187 0x10001100, 0x10001500, 0x11001100, 0x11001500,
1188 0x00081000, 0x00081400, 0x01081000, 0x01081400,
1189 0x00081000, 0x00081400, 0x01081000, 0x01081400,
1190 0x00081100, 0x00081500, 0x01081100, 0x01081500,
1191 0x00081100, 0x00081500, 0x01081100, 0x01081500,
1192 0x10081000, 0x10081400, 0x11081000, 0x11081400,
1193 0x10081000, 0x10081400, 0x11081000, 0x11081400,
1194 0x10081100, 0x10081500, 0x11081100, 0x11081500,
1195 0x10081100, 0x10081500, 0x11081100, 0x11081500,
1196 0x00001008, 0x00001408, 0x01001008, 0x01001408,
1197 0x00001008, 0x00001408, 0x01001008, 0x01001408,
1198 0x00001108, 0x00001508, 0x01001108, 0x01001508,
1199 0x00001108, 0x00001508, 0x01001108, 0x01001508,
1200 0x10001008, 0x10001408, 0x11001008, 0x11001408,
1201 0x10001008, 0x10001408, 0x11001008, 0x11001408,
1202 0x10001108, 0x10001508, 0x11001108, 0x11001508,
1203 0x10001108, 0x10001508, 0x11001108, 0x11001508,
1204 0x00081008, 0x00081408, 0x01081008, 0x01081408,
1205 0x00081008, 0x00081408, 0x01081008, 0x01081408,
1206 0x00081108, 0x00081508, 0x01081108, 0x01081508,
1207 0x00081108, 0x00081508, 0x01081108, 0x01081508,
1208 0x10081008, 0x10081408, 0x11081008, 0x11081408,
1209 0x10081008, 0x10081408, 0x11081008, 0x11081408,
1210 0x10081108, 0x10081508, 0x11081108, 0x11081508,
1211 0x10081108, 0x10081508, 0x11081108, 0x11081508
1212 );
1213
1214 $keys = array();
1215 for ($des_round = 0; $des_round < $this->des_rounds; ++$des_round) {
1216 // pad the key and remove extra characters as appropriate.
1217 $key = str_pad(substr($this->key, $des_round * 8, 8), 8, "\0");
1218
1219 // Perform the PC/1 transformation and compute C and D.
1220 $t = unpack('Nl/Nr', $key);
1221 list($l, $r) = array($t['l'], $t['r']);
1222 $key = ($this->shuffle[$pc1map[ $r & 0xFF]] & "\x80\x80\x80\x80\x80\x80\x80\x00") |
1223 ($this->shuffle[$pc1map[($r >> 8) & 0xFF]] & "\x40\x40\x40\x40\x40\x40\x40\x00") |
1224 ($this->shuffle[$pc1map[($r >> 16) & 0xFF]] & "\x20\x20\x20\x20\x20\x20\x20\x00") |
1225 ($this->shuffle[$pc1map[($r >> 24) & 0xFF]] & "\x10\x10\x10\x10\x10\x10\x10\x00") |
1226 ($this->shuffle[$pc1map[ $l & 0xFF]] & "\x08\x08\x08\x08\x08\x08\x08\x00") |
1227 ($this->shuffle[$pc1map[($l >> 8) & 0xFF]] & "\x04\x04\x04\x04\x04\x04\x04\x00") |
1228 ($this->shuffle[$pc1map[($l >> 16) & 0xFF]] & "\x02\x02\x02\x02\x02\x02\x02\x00") |
1229 ($this->shuffle[$pc1map[($l >> 24) & 0xFF]] & "\x01\x01\x01\x01\x01\x01\x01\x00");
1230 $key = unpack('Nc/Nd', $key);
1231 $c = ( $key['c'] >> 4) & 0x0FFFFFFF;
1232 $d = (($key['d'] >> 4) & 0x0FFFFFF0) | ($key['c'] & 0x0F);
1233
1234 $keys[$des_round] = array(
1235 self::ENCRYPT => array(),
1236 self::DECRYPT => array_fill(0, 32, 0)
1237 );
1238 for ($i = 0, $ki = 31; $i < 16; ++$i, $ki-= 2) {
1239 $c <<= $shifts[$i];
1240 $c = ($c | ($c >> 28)) & 0x0FFFFFFF;
1241 $d <<= $shifts[$i];
1242 $d = ($d | ($d >> 28)) & 0x0FFFFFFF;
1243
1244 // Perform the PC-2 transformation.
1245 $cp = $pc2mapc1[ $c >> 24 ] | $pc2mapc2[($c >> 16) & 0xFF] |
1246 $pc2mapc3[($c >> 8) & 0xFF] | $pc2mapc4[ $c & 0xFF];
1247 $dp = $pc2mapd1[ $d >> 24 ] | $pc2mapd2[($d >> 16) & 0xFF] |
1248 $pc2mapd3[($d >> 8) & 0xFF] | $pc2mapd4[ $d & 0xFF];
1249
1250 // Reorder: odd bytes/even bytes. Push the result in key schedule.
1251 $val1 = ( $cp & 0xFF000000) | (($cp << 8) & 0x00FF0000) |
1252 (($dp >> 16) & 0x0000FF00) | (($dp >> 8) & 0x000000FF);
1253 $val2 = (($cp << 8) & 0xFF000000) | (($cp << 16) & 0x00FF0000) |
1254 (($dp >> 8) & 0x0000FF00) | ( $dp & 0x000000FF);
1255 $keys[$des_round][self::ENCRYPT][ ] = $val1;
1256 $keys[$des_round][self::DECRYPT][$ki - 1] = $val1;
1257 $keys[$des_round][self::ENCRYPT][ ] = $val2;
1258 $keys[$des_round][self::DECRYPT][$ki ] = $val2;
1259 }
1260 }
1261
1262 switch ($this->des_rounds) {
1263 case 3: // 3DES keys
1264 $this->keys = array(
1265 self::ENCRYPT => array_merge(
1266 $keys[0][self::ENCRYPT],
1267 $keys[1][self::DECRYPT],
1268 $keys[2][self::ENCRYPT]
1269 ),
1270 self::DECRYPT => array_merge(
1271 $keys[2][self::DECRYPT],
1272 $keys[1][self::ENCRYPT],
1273 $keys[0][self::DECRYPT]
1274 )
1275 );
1276 break;
1277 // case 1: // DES keys
1278 default:
1279 $this->keys = array(
1280 self::ENCRYPT => $keys[0][self::ENCRYPT],
1281 self::DECRYPT => $keys[0][self::DECRYPT]
1282 );
1283 }
1284 }
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

References $c, $d, phpseclib\Crypt\DES\$des_rounds, $i, phpseclib\Crypt\Base\$key, phpseclib\Crypt\DES\$keys, $l, $r, $t, phpseclib\Crypt\DES\DECRYPT, and phpseclib\Crypt\DES\ENCRYPT.

◆ isValidEngine()

phpseclib\Crypt\DES::isValidEngine (   $engine)

Test for engine validity.

This is mainly just a wrapper to set things up for \phpseclib\Crypt\Base::isValidEngine()

See also
\phpseclib\Crypt\Base::isValidEngine()
Parameters
int$engine@access public
Returns
bool

Reimplemented from phpseclib\Crypt\Base.

Reimplemented in phpseclib\Crypt\TripleDES.

Definition at line 593 of file DES.php.

594 {
595 if ($this->key_length_max == 8) {
596 if ($engine == self::ENGINE_OPENSSL) {
597 $this->cipher_name_openssl_ecb = 'des-ecb';
598 $this->cipher_name_openssl = 'des-' . $this->_openssl_translate_mode();
599 }
600 }
601
602 return parent::isValidEngine($engine);
603 }
_openssl_translate_mode()
phpseclib <-> OpenSSL Mode Mapper
Definition: Base.php:1423

References phpseclib\Crypt\Base\$engine, and phpseclib\Crypt\Base\_openssl_translate_mode().

+ Here is the call graph for this function:

◆ setKey()

phpseclib\Crypt\DES::setKey (   $key)

Sets the key.

Keys can be of any length. DES, itself, uses 64-bit keys (eg. strlen($key) == 8), however, we only use the first eight, if $key has more then eight characters in it, and pad $key with the null byte if it is less then eight characters long.

DES also requires that every eighth bit be a parity bit, however, we'll ignore that.

If the key is not explicitly set, it'll be assumed to be all zero's.

See also
\phpseclib\Crypt\Base::setKey() @access User interface
Parameters
string$key

Reimplemented from phpseclib\Crypt\Base.

Reimplemented in phpseclib\Crypt\TripleDES.

Definition at line 620 of file DES.php.

621 {
622 // We check/cut here only up to max length of the key.
623 // Key padding to the proper length will be done in _setupKey()
624 if (strlen($key) > $this->key_length_max) {
625 $key = substr($key, 0, $this->key_length_max);
626 }
627
628 // Sets the key
629 parent::setKey($key);
630 }

References phpseclib\Crypt\Base\$key.

Field Documentation

◆ $block_size

phpseclib\Crypt\DES::$block_size = 8

Definition at line 78 of file DES.php.

◆ $cfb_init_len

phpseclib\Crypt\DES::$cfb_init_len = 500

Definition at line 120 of file DES.php.

◆ $cipher_name_mcrypt

phpseclib\Crypt\DES::$cipher_name_mcrypt = 'des'

Definition at line 96 of file DES.php.

◆ $des_rounds

phpseclib\Crypt\DES::$des_rounds = 1

◆ $invipmap

phpseclib\Crypt\DES::$invipmap

Definition at line 345 of file DES.php.

◆ $ipmap

phpseclib\Crypt\DES::$ipmap

Definition at line 303 of file DES.php.

◆ $key_length

phpseclib\Crypt\DES::$key_length = 8

Definition at line 87 of file DES.php.

◆ $key_length_max

phpseclib\Crypt\DES::$key_length_max = 8

Definition at line 141 of file DES.php.

◆ $keys

phpseclib\Crypt\DES::$keys

Definition at line 150 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock(), and phpseclib\Crypt\DES\_setupKey().

◆ $openssl_mode_names

phpseclib\Crypt\DES::$openssl_mode_names
Initial value:
= array(
self::MODE_ECB => 'des-ecb',
self::MODE_CBC => 'des-cbc',
self::MODE_CFB => 'des-cfb',
self::MODE_OFB => 'des-ofb'
)

Definition at line 105 of file DES.php.

◆ $sbox1

phpseclib\Crypt\DES::$sbox1
Initial value:
= array(
0x00808200, 0x00000000, 0x00008000, 0x00808202,
0x00808002, 0x00008202, 0x00000002, 0x00008000,
0x00000200, 0x00808200, 0x00808202, 0x00000200,
0x00800202, 0x00808002, 0x00800000, 0x00000002,
0x00000202, 0x00800200, 0x00800200, 0x00008200,
0x00008200, 0x00808000, 0x00808000, 0x00800202,
0x00008002, 0x00800002, 0x00800002, 0x00008002,
0x00000000, 0x00000202, 0x00008202, 0x00800000,
0x00008000, 0x00808202, 0x00000002, 0x00808000,
0x00808200, 0x00800000, 0x00800000, 0x00000200,
0x00808002, 0x00008000, 0x00008200, 0x00800002,
0x00000200, 0x00000002, 0x00800202, 0x00008202,
0x00808202, 0x00008002, 0x00808000, 0x00800202,
0x00800002, 0x00000202, 0x00008202, 0x00808200,
0x00000202, 0x00800200, 0x00800200, 0x00000000,
0x00008002, 0x00008200, 0x00000000, 0x00808002
)

Definition at line 389 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $sbox2

phpseclib\Crypt\DES::$sbox2
Initial value:
= array(
0x40084010, 0x40004000, 0x00004000, 0x00084010,
0x00080000, 0x00000010, 0x40080010, 0x40004010,
0x40000010, 0x40084010, 0x40084000, 0x40000000,
0x40004000, 0x00080000, 0x00000010, 0x40080010,
0x00084000, 0x00080010, 0x40004010, 0x00000000,
0x40000000, 0x00004000, 0x00084010, 0x40080000,
0x00080010, 0x40000010, 0x00000000, 0x00084000,
0x00004010, 0x40084000, 0x40080000, 0x00004010,
0x00000000, 0x00084010, 0x40080010, 0x00080000,
0x40004010, 0x40080000, 0x40084000, 0x00004000,
0x40080000, 0x40004000, 0x00000010, 0x40084010,
0x00084010, 0x00000010, 0x00004000, 0x40000000,
0x00004010, 0x40084000, 0x00080000, 0x40000010,
0x00080010, 0x40004010, 0x40000010, 0x00080010,
0x00084000, 0x00000000, 0x40004000, 0x00004010,
0x40000000, 0x40080010, 0x40084010, 0x00084000
)

Definition at line 414 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $sbox3

phpseclib\Crypt\DES::$sbox3
Initial value:
= array(
0x00000104, 0x04010100, 0x00000000, 0x04010004,
0x04000100, 0x00000000, 0x00010104, 0x04000100,
0x00010004, 0x04000004, 0x04000004, 0x00010000,
0x04010104, 0x00010004, 0x04010000, 0x00000104,
0x04000000, 0x00000004, 0x04010100, 0x00000100,
0x00010100, 0x04010000, 0x04010004, 0x00010104,
0x04000104, 0x00010100, 0x00010000, 0x04000104,
0x00000004, 0x04010104, 0x00000100, 0x04000000,
0x04010100, 0x04000000, 0x00010004, 0x00000104,
0x00010000, 0x04010100, 0x04000100, 0x00000000,
0x00000100, 0x00010004, 0x04010104, 0x04000100,
0x04000004, 0x00000100, 0x00000000, 0x04010004,
0x04000104, 0x00010000, 0x04000000, 0x04010104,
0x00000004, 0x00010104, 0x00010100, 0x04000004,
0x04010000, 0x04000104, 0x00000104, 0x04010000,
0x00010104, 0x00000004, 0x04010004, 0x00010100
)

Definition at line 439 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $sbox4

phpseclib\Crypt\DES::$sbox4
Initial value:
= array(
0x80401000, 0x80001040, 0x80001040, 0x00000040,
0x00401040, 0x80400040, 0x80400000, 0x80001000,
0x00000000, 0x00401000, 0x00401000, 0x80401040,
0x80000040, 0x00000000, 0x00400040, 0x80400000,
0x80000000, 0x00001000, 0x00400000, 0x80401000,
0x00000040, 0x00400000, 0x80001000, 0x00001040,
0x80400040, 0x80000000, 0x00001040, 0x00400040,
0x00001000, 0x00401040, 0x80401040, 0x80000040,
0x00400040, 0x80400000, 0x00401000, 0x80401040,
0x80000040, 0x00000000, 0x00000000, 0x00401000,
0x00001040, 0x00400040, 0x80400040, 0x80000000,
0x80401000, 0x80001040, 0x80001040, 0x00000040,
0x80401040, 0x80000040, 0x80000000, 0x00001000,
0x80400000, 0x80001000, 0x00401040, 0x80400040,
0x80001000, 0x00001040, 0x00400000, 0x80401000,
0x00000040, 0x00400000, 0x00001000, 0x00401040
)

Definition at line 464 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $sbox5

phpseclib\Crypt\DES::$sbox5
Initial value:
= array(
0x00000080, 0x01040080, 0x01040000, 0x21000080,
0x00040000, 0x00000080, 0x20000000, 0x01040000,
0x20040080, 0x00040000, 0x01000080, 0x20040080,
0x21000080, 0x21040000, 0x00040080, 0x20000000,
0x01000000, 0x20040000, 0x20040000, 0x00000000,
0x20000080, 0x21040080, 0x21040080, 0x01000080,
0x21040000, 0x20000080, 0x00000000, 0x21000000,
0x01040080, 0x01000000, 0x21000000, 0x00040080,
0x00040000, 0x21000080, 0x00000080, 0x01000000,
0x20000000, 0x01040000, 0x21000080, 0x20040080,
0x01000080, 0x20000000, 0x21040000, 0x01040080,
0x20040080, 0x00000080, 0x01000000, 0x21040000,
0x21040080, 0x00040080, 0x21000000, 0x21040080,
0x01040000, 0x00000000, 0x20040000, 0x21000000,
0x00040080, 0x01000080, 0x20000080, 0x00040000,
0x00000000, 0x20040000, 0x01040080, 0x20000080
)

Definition at line 489 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $sbox6

phpseclib\Crypt\DES::$sbox6
Initial value:
= array(
0x10000008, 0x10200000, 0x00002000, 0x10202008,
0x10200000, 0x00000008, 0x10202008, 0x00200000,
0x10002000, 0x00202008, 0x00200000, 0x10000008,
0x00200008, 0x10002000, 0x10000000, 0x00002008,
0x00000000, 0x00200008, 0x10002008, 0x00002000,
0x00202000, 0x10002008, 0x00000008, 0x10200008,
0x10200008, 0x00000000, 0x00202008, 0x10202000,
0x00002008, 0x00202000, 0x10202000, 0x10000000,
0x10002000, 0x00000008, 0x10200008, 0x00202000,
0x10202008, 0x00200000, 0x00002008, 0x10000008,
0x00200000, 0x10002000, 0x10000000, 0x00002008,
0x10000008, 0x10202008, 0x00202000, 0x10200000,
0x00202008, 0x10202000, 0x00000000, 0x10200008,
0x00000008, 0x00002000, 0x10200000, 0x00202008,
0x00002000, 0x00200008, 0x10002008, 0x00000000,
0x10202000, 0x10000000, 0x00200008, 0x10002008
)

Definition at line 514 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $sbox7

phpseclib\Crypt\DES::$sbox7
Initial value:
= array(
0x00100000, 0x02100001, 0x02000401, 0x00000000,
0x00000400, 0x02000401, 0x00100401, 0x02100400,
0x02100401, 0x00100000, 0x00000000, 0x02000001,
0x00000001, 0x02000000, 0x02100001, 0x00000401,
0x02000400, 0x00100401, 0x00100001, 0x02000400,
0x02000001, 0x02100000, 0x02100400, 0x00100001,
0x02100000, 0x00000400, 0x00000401, 0x02100401,
0x00100400, 0x00000001, 0x02000000, 0x00100400,
0x02000000, 0x00100400, 0x00100000, 0x02000401,
0x02000401, 0x02100001, 0x02100001, 0x00000001,
0x00100001, 0x02000000, 0x02000400, 0x00100000,
0x02100400, 0x00000401, 0x00100401, 0x02100400,
0x00000401, 0x02000001, 0x02100401, 0x02100000,
0x00100400, 0x00000000, 0x00000001, 0x02100401,
0x00000000, 0x00100401, 0x02100000, 0x00000400,
0x02000001, 0x02000400, 0x00000400, 0x00100001
)

Definition at line 539 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $sbox8

phpseclib\Crypt\DES::$sbox8
Initial value:
= array(
0x08000820, 0x00000800, 0x00020000, 0x08020820,
0x08000000, 0x08000820, 0x00000020, 0x08000000,
0x00020020, 0x08020000, 0x08020820, 0x00020800,
0x08020800, 0x00020820, 0x00000800, 0x00000020,
0x08020000, 0x08000020, 0x08000800, 0x00000820,
0x00020800, 0x00020020, 0x08020020, 0x08020800,
0x00000820, 0x00000000, 0x00000000, 0x08020020,
0x08000020, 0x08000800, 0x00020820, 0x00020000,
0x00020820, 0x00020000, 0x08020800, 0x00000800,
0x00000020, 0x08020020, 0x00000800, 0x00020820,
0x08000800, 0x00000020, 0x08000020, 0x08020000,
0x08020020, 0x08000000, 0x00020000, 0x08000820,
0x00000000, 0x08020820, 0x00020020, 0x08000020,
0x08020000, 0x08000800, 0x08000820, 0x00000000,
0x08020820, 0x00020800, 0x00020800, 0x00000820,
0x00000820, 0x00020020, 0x08000000, 0x08020800
)

Definition at line 564 of file DES.php.

Referenced by phpseclib\Crypt\DES\_processBlock().

◆ $shuffle

phpseclib\Crypt\DES::$shuffle

Definition at line 164 of file DES.php.

◆ DECRYPT

const phpseclib\Crypt\DES::DECRYPT = 1

Contains $keys[self::DECRYPT].

Definition at line 68 of file DES.php.

Referenced by phpseclib\Crypt\DES\_setupInlineCrypt(), and phpseclib\Crypt\DES\_setupKey().

◆ ENCRYPT

const phpseclib\Crypt\DES::ENCRYPT = 0

#+ @access private

See also
\phpseclib\Crypt\DES::_setupKey()
\phpseclib\Crypt\DES::_processBlock() Contains $keys[self::ENCRYPT]

Definition at line 64 of file DES.php.

Referenced by phpseclib\Crypt\DES\_setupInlineCrypt(), and phpseclib\Crypt\DES\_setupKey().


The documentation for this class was generated from the following file: