コード例 #1
0
ファイル: ds.php プロジェクト: kangaroot/phpldapadmin
 /**
  * Get the login password of the user logged into this datastore's connection method
  */
 protected function getPassword($method = null)
 {
     if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
         debug_log('Entered (%%)', 17, 0, __FILE__, __LINE__, __METHOD__, $fargs);
     }
     $method = $this->getMethod($method);
     # For anonymous binds
     if ($method == 'anon') {
         if (isset($_SESSION['USER'][$this->index][$method]['name'])) {
             return '';
         } else {
             return null;
         }
     }
     switch ($this->getAuthType()) {
         case 'config':
         case 'proxy':
             if (!isset($_SESSION['USER'][$this->index][$method]['pass'])) {
                 return $this->getValue('login', 'bind_pass');
             } else {
                 return blowfish_decrypt($_SESSION['USER'][$this->index][$method]['pass']);
             }
         case 'http':
         case 'session':
             if (!isset($_SESSION['USER'][$this->index][$method]['pass'])) {
                 # If our bind_pass is set, we'll pass that back for logins.
                 return !is_null($this->getValue('login', 'bind_pass')) && $method == 'login' ? $this->getValue('login', 'bind_pass') : null;
             } else {
                 return blowfish_decrypt($_SESSION['USER'][$this->index][$method]['pass']);
             }
         default:
             die(sprintf('Error: %s hasnt been configured for auth_type %s', __METHOD__, $this->getAuthType()));
     }
 }
コード例 #2
0
ファイル: demo2.php プロジェクト: astrxlegaulois/HTS
<br>
<?php 
include "blowfish.php";
include "sudoku_seb.php";
$text = "6,5,,7,8,,,2,,3,,,,,,7,,9,9,,,1,2,,4,5,6,2,1,9,3,4,5,6,7,8,5,,,6,7,8,9,1,,8,7,6,9,1,2,3,4,5,7,6,,8,9,1,,3,4,4,3,2,,6,7,8,,1,1,9,8,,,,5,6,";
echo "</br>Sudoku reading:";
$sudoku = initSudoku($text);
echo $sudoku;
echo "</br>Sudoku solving:";
$sudoku = resolutionSimple($sudoku);
echo $sudoku;
echo "</br>Sudoku parsing:";
$result = sudokuToString($sudoku);
echo $result;
echo "</br>Sha1:";
$result = sha1($result);
echo $result;
echo "</br>Blowfish key generation:";
keys($result);
//Schlüssel Definieren
echo "</br>key:";
echo $key;
echo "</br>Blowfish key generation:";
//$text = blowfish_crypt($text); //Verschlüsseln
$encrypted = "Vm6c7wAK15IeEvUBshqV2g==";
echo "</br>Verschlüsseln Text:";
echo $encrypted;
$decrypted = blowfish_decrypt($encrypted);
//Entschlüsseln
echo "</br>Unverschlüsselter Text:";
echo $decrypted;
コード例 #3
0
ファイル: demo1.php プロジェクト: astrxlegaulois/HTS
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" alink="#0000FF" vlink="#0000FF">
<?php 
$key = $_POST['key'];
include "blowfish.php";
$text = trim($_POST['text']);
if (isset($_POST['key'])) {
    keys($_POST['key']);
}
//Schlüssel Definieren
if (isset($_POST["crypt"])) {
    $text = blowfish_crypt($text);
    //Verschlüsseln
    $s = "Verschl&uuml;sselt";
} elseif (isset($_POST["decrypt"])) {
    $text = blowfish_decrypt($text);
    //Entschlüsseln
    $s = "Entschl&uuml;sselt";
}
?>
<br>
<h1 align="center">blowfish demo 1</h1>
<br>
<form action="" method="post" target="">
<table width="80%" border="0" align="center">
<tr>
 <td>Key:</td>
 <td><input type="Text" name="key" value="<?php 
echo $key;
?>
" size="" maxlength="12"></td>