Subversion Repositories php-qbpwcf

Rev

Blame | Last modification | View Log | RSS feed

#!/usr/bin/php
<?php

/*
        QBPWCF, Quick Build PHP website Component base on Fedora Linux.
    Copyright (C) 2014~2026 MIN ZHI, CHEN

    This file is part of QBPWCF.

    QBPWCF is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    QBPWCF is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with QBPWCF.  If not, see <http://www.gnu.org/licenses/>.

*/

#使用命名空間qbpwcf
namespace qbpwcf;

#取得 lib path
exec("php -f ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/libexec/folderOfUsrLib.php"),$output,$status);

#如果執行失敗
if($status!==0){

        #debug
        var_dump(__LINE__,$output);

        #結束執行,回傳shell 1.
        exit(1);

        }#if end

#儲存lib path
$folderOfUsrLib=$output[0];

#以該檔案的實際位置的 lib path 為 include path 首位
$output=array();
exec("cd ".escapeshellarg(pathinfo(__FILE__)["dirname"]."/../".$folderOfUsrLib."/qbpwcf").";pwd;",$output,$status);

#如果執行失敗
if($status!==0){

        #debug
        var_dump(__LINE__,$output);

        #結束執行,回傳shell 1.
        exit(1);

        }#if end

#設置 include path
set_include_path($output[0].PATH_SEPARATOR.get_include_path());

#匯入外部套件
require_once("allInOne.php");

#該指令的 help 文件
function help(){

        #印出指令說明
        echo basename($_SERVER["PHP_SELF"])." is a program to encrypt string or stdin by gpg then stdout.".PHP_EOL;
        echo basename($_SERVER["PHP_SELF"])." usage:".PHP_EOL;
        echo "--input [string to encrypt]".PHP_EOL;
        echo "--outputHexWhenEncrypt [on/off] deafult is \"on\"".PHP_EOL;
        echo "\t\"on\" means format of stdout will be ascii;\"false\" means format of stdout will be binary.".PHP_EOL;
        echo "stdin example:".PHP_EOL;
        echo "\techo \"password to encrypt\" | ".basename($_SERVER["PHP_SELF"]).PHP_EOL;
        echo "--decrypt [on/off] defalult if \"off\".".PHP_EOL;
        echo "\t\"on\" means decrypt input;\"false\" means encrypt input.".PHP_EOL;
        echo "--hex2binFirstWhenDecrypt [on/off] default if on when decrypt is on.".PHP_EOL; 
        echo "\t\"on\" means order of decrypt process is hex2bin first then gpg gpe decrypt;\"off\" meams gpg decrypt directly.".PHP_EOL;
        echo "chooseIdByEmail [email for gpg id] default is gnupgId from config file etc/qbpwcf/allInOneConfig.php".PHP_EOL;
        
        #結束執行
        exit;

        }#function help end
        
#函式說明:
#解析參數.
#回傳結果:
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
#$reuslt["error"],執行不正常結束的錯訊息陣列.
#$result["function"],當前執行的函式名稱.
#$result["content"],解析好的參數陣列.
#$result["content"][$key][$i],參數 $key 的 $i+1 個參數數值內容.
#$result["program"],字串,執行的程式名稱.
#必填參數:
#無
#可省略參數:
#$conf["helpFunc"],如果解析的參數不成對,則要執行的函式名稱.
$conf["helpFunc"]="help";
#備註:
#僅能在命令列底下執行.
#建議:
#以後可將參數 --a--b 的名稱與後面的數值 $value 存成 $result["a"]["b"][$i]=$value .
$parseArgu=cmd::parseArgu($conf);
unset($conf);

#如果解析參數失敗
if($parseArgu["status"]==="false"){

        #印出結果
        var_dump($parseArgu);

        #結束執行,回傳 shell 1
        exit(1);

        }#if end

#函式說明:
#檢查必填與可省略的參數,可省略參數可指定預設要給與什麼數值內容.
#回傳結果:
#$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
#$result["error"],執行不正常結束的錯訊息陣列.
#$result["simpleError"],簡單表示的錯誤訊息.
#$result["function"],當前執行的函式名稱.
#$result["argu"],設置給予的參數.
#$result["passed"],識別要檢查的全體變數是否存在以及型態是否正確的變數,"true"代表檢查全部通過;"false"代表檢查不通過
#$result[$shouldBeCheckedVarName]["varExist"],所檢查的變數是否存在,"false"代表不存在;"true"代表存在
#$result[$shouldBeCheckedVarName]["varType"],所檢查的變數型態是否正確,"false"代表錯誤;"true"代表正確
#$result[$shouldBeCheckedVarName]["error"],每個參數設定的錯誤訊息
#$result["shouldNotBeEmpty"],不應該為空字串或控陣列的變數.
#$result["argu"],字串陣列,目前輸入的參數名稱陣列.
#$result["legalVarName"],字串陣列,合法可用的參數名稱陣列.
#$result["notNeedVar"],字串陣列,多餘的參數名稱.
#必填參數:
#$conf["varInput"],陣列變數,要檢查的陣列變數,請在要檢查的參數前面加上&,這樣變動的結果才能被套用。
$conf["varInput"]=&$parseArgu["content"];
#$conf["referenceVarKey"],字串,$conf參數後面的key值,用於移除不要的參考陣列.
$conf["referenceVarKey"]="variableCheck::checkArguments";
#可省略參數:
#$conf["mustBeFilledVariableName"],爲必填參數的變數名稱陣列,形態爲陣列變數,元素數量需要跟"mustBeFilledVariableType"參數的元素數量一致,例如: $conf["mustBeFilledVariableName"] = array("id","account","password");
#$conf["mustBeFilledVariableName"]=array();
#$conf["mustBeFilledVariableType"],爲必填參數的變數陣列應該爲何種變數形態,形態爲陣列,元素數量需要跟"mustBeFilledVariableName"參數的元素數量一致,例如: $conf["mustBeFilledVariableType"] = array("string",integer,"double","resource","object"); , null、any代表不指定變數形態.其中 resource也包含"resource (closed)".
#$conf["mustBeFilledVariableType"]=array();
#$conf["canBeEmptyString"],字串,必填變數內容如果是空字串就不能算是有設置的話,請設為"false",預設爲"true",可以為空字串.
#$conf["canBeEmptyString"]="false";
#$conf["canNotBeEmpty"],字串陣列,哪些必填參數的內容不得為空字串或空陣列,僅當$conf["canBeEmptyString"]為"true"時會生效.
#$conf["canNotBeEmpty"]=array();
#$conf["canBeEmpty"],字串陣列,哪些必填參數的內容可為空字串或空陣列,僅當$conf["canBeEmptyString"]為"false"時會生效.
#$conf["canBeEmpty"]=array();
#$conf["skipableVariableCanNotBeEmpty"],字串陣列,哪些可省略參數不可以為空字串或空陣列.
#$conf["skipableVariableCanNotBeEmpty"]=array();
#$conf["skipableVariableName"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableName"] = array("id","account","password");
$conf["skipableVariableName"]=array("input","outputHexWhenEncrypt","decrypt","hex2binFirstWhenDecrypt","chooseIdByEmail");
#$conf["skipableVariableType"],陣列字串,爲可省略參數的變數名稱陣列,形態爲陣列變數,例如: $conf["skipableVariableType"] = array("string",integer,"double");
$conf["skipableVariableType"]=array("array","array","array","array","array");
#$conf["skipableVarDefaultValue"],字串陣列,每個不存在的可省略變數要初始化為什麼,null與代表不指定,若預設值是參數之一,請將$conf["mustBeFilledVar"]改成"\$conf["\mustBeFilledVar\"]".
$conf["skipableVarDefaultValue"]=array(null,array("on"),array("off"),null,array(gnupgId));
#$conf["disallowAllSkipableVarIsEmpty"],字串,是否允許每個可省略參數都為空字串,預設為"true"允許,反之為"false".
#$conf["disallowAllSkipableVarIsEmpty"]="";
#$conf["disallowAllSkipableVarIsEmptyArray"],字串,是否允許每個可省略參數都為空陣列,預設為"true"允許,反之為"false".
#$conf["disallowAllSkipableVarIsEmptyArray"]="";
#$conf["disallowAllSkipableVarNotExist"],字串,是否不允許每個可省略參數都不存在,預設為"false"代表允許,反之為"true".
#$conf["disallowAllSkipableVarNotExist"]="";
#$conf["arrayCountEqualCheck"],字串陣列,為檢查哪些陣列參數的元素數量要一樣,$conf["arrayCountEqualCheck"][$i]=array()為第$i組key為哪些的變數其元素數量要相等.
#$conf["arrayCountEqualCheck"][]=array();
#參考資料:
#array_keys=>http://php.net/manual/en/function.array-keys.php
#備註:
#無.
$checkArguments=variableCheck::checkArguments($conf);
unset($conf);

#如果執行異常
if($checkArguments["status"]==="false"){

        #debug
        var_dump($checkArguments);

        #結束執行,回傳 shell 1
        exit(1);

        }#if end
        
#如果執行異常
if($checkArguments["passed"]==="false"){

        #debug
        var_dump($checkArguments);

        #結束執行,回傳 shell 1
        exit(1);

        }#if end

#取得 outputHexWhenEncrypt 參數的內容
$outputHexWhenEncrypt=$parseArgu["content"]["outputHexWhenEncrypt"][0];

#取得 decrypt 參數的內容
$decrypt=$parseArgu["content"]["decrypt"][0];

#取得 chooseIdByEmail 參數的內容
$chooseIdByEmail=$parseArgu["content"]["chooseIdByEmail"][0];

#如果有 input 參數
if(isset($parseArgu["content"]["input"])){

        #取得輸入的 input 參數數值
        $input=$parseArgu["content"]["input"][0];

        }#if end

#反之
else{

        #讀取 stdin - start

        #讀取不定長度的資源
        #參考資料:
        #https://www.php.net/manual/en/function.fread.php

        #初始化標準輸入的內容
        $stdin="";

        #如果有標準輸入的內容
        while(!FEOF(STDIN)){

                #串接讀取的標準輸入
                $stdin=$stdin.fread(STDIN,8192);

                }#while end
                
        #如果有標準輸入
        if(!empty($stdin)){

                #取得其參考
                $input=&$stdin;
                
                /*
                
                #透過 stdin 結尾會多一個 byte(用於識別FEOF)
        
                #函式說明:
                #移除字串結尾的1byte
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["error"],錯誤訊息陣列.
                #$result["function"],當前執行的函數名稱.
                #$result["content"],處理好的字串
                #必填參數:
                #$conf["str"],字串",要處理的字串
                $conf["stringProcess::delLastByte"]["str"]=$input;
                #可省略參數:
                #無.
                #參考資料:
                #無.
                #備註:
                #無.
                $delLastByte=stringProcess::delLastByte($conf["stringProcess::delLastByte"]);
                unset($conf["stringProcess::delLastByte"]);
                
                #如果執行異常
                if($delLastByte["status"]==="false"){

                        #印出結果
                        var_dump($delLastByte);

                        #結束執行,回傳 shell 1
                        exit(1);

                        }#if end
                        
                #取得處理好的字串結果
                $input=$delLastByte["content"];
                
                */

                }#if end
        
        #讀取 stdin - end

        }#else 

#如果是要 decrypt
if($decrypt==="on"){

        #如果沒有指定參數 hex2binFirstWhenDecrypt
        if(!isset($parseArgu["content"]["hex2binFirstWhenDecrypt"])){
        
                #設置為 "on"
                $hex2binFirstWhenDecrypt="on";
        
                }#if end
                
        #反之
        else{
        
                #取得參數 hex2binFirstWhenDecrypt 的數值
                $hex2binFirstWhenDecrypt=$parseArgu["content"]["hex2binFirstWhenDecrypt"][0];
        
                }#else end

        # hex to bin then gpg decrypt
        if($hex2binFirstWhenDecrypt==="on"){
        
                #函式說明:
                #加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,gpg,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.
                #回傳結果:
                #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
                #$result["function"],當前執行的函數名稱.
                #$result["content"],加密後的結果.
                #$result["error"],錯誤訊息陣列.
                #$result["argu"],使用的參數.
                #必填參數:
                #$conf["enCodeStr"],any,要加密的字串,陣列,物件.
                $conf["enCodeStr"]=$input;
                #$conf["enCodeType"],"字串",加密或編碼的類型,有"sha1"與"md5"與"p_hash"與"aes256"與"qbpwcf"與"bin2hex"與"hex2bin"與"gpg"與"hex2bin&gpg",9種,"sha1"較耗時;"md5"較快;"p_hash"適用於密碼加密;"aes256"是對稱式加解密;"qbpwcf"是透過json_encode、urlencode、base64_encode的結果;"bin2hex"是依照每個byte的整數數值轉成"00"~"FF"後的結果,反之為"hex2bin";"gpg"是應用gpg進行加解密,需要先有ID對應的key;"hex2bin&gpg"為先hex2bin在進行gpg加解密.
                $conf["enCodeType"]="hex2bin";
                #可省略參數:
                #$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".
                #$conf["sha1Raw"]="false";
                #$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.
                #$conf["p_hash"]="";
                #$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.
                #$conf["keyForAes256"]="";
                #$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.
                #$conf["aes256Encode"]="";
                #$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.
                #$conf["qbpwcfDecode"]="false";
                #$conf["gpgDecrypt"],字串,若"enCodeType"為"gpg",則預設為"false",代表加密;反之為"true",代表解密.
                #$conf["gpgDecrypt"]="true";
                #$conf["gpgId"],字串,若"enCodeType"為"gpg"時,要使用的gpg id,預設為gnupgId.
                #$conf["gpgId"]=$chooseIdByEmail;
                #參考資料:
                #sha1=>http://php.net/manual/en/function.sha1.php
                #md5=>http://php.net/manual/en/function.md5.php
                #password_hash=>http://php.net/manual/en/function.password-hash.php
                #password_verify=>http://php.net/manual/en/function.password-verify.php
                #json_decode=>https://www.php.net/manual/en/function.json-decode.php
                #備註:
                #無.
                $enCodeStr=authenticate::enCodeStr($conf);
                unset($conf);

                #如果執行異常
                if($enCodeStr["status"]==="false"){

                        #印出結果
                        var_dump($enCodeStr);

                        #結束執行,回傳 shell 1
                        exit(1);

                        }#if end
                        
                #取得結果
                $input=$enCodeStr["content"];
                
                #var_dump($input);exit;
                
                }#if end

        #函式說明:
        #加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,gpg,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$result["function"],當前執行的函數名稱.
        #$result["content"],加密後的結果.
        #$result["error"],錯誤訊息陣列.
        #$result["argu"],使用的參數.
        #必填參數:
        #$conf["enCodeStr"],any,要加密的字串,陣列,物件.
        $conf["enCodeStr"]=$input;
        #$conf["enCodeType"],"字串",加密或編碼的類型,有"sha1"與"md5"與"p_hash"與"aes256"與"qbpwcf"與"bin2hex"與"hex2bin"與"gpg"與"hex2bin&gpg",9種,"sha1"較耗時;"md5"較快;"p_hash"適用於密碼加密;"aes256"是對稱式加解密;"qbpwcf"是透過json_encode、urlencode、base64_encode的結果;"bin2hex"是依照每個byte的整數數值轉成"00"~"FF"後的結果,反之為"hex2bin";"gpg"是應用gpg進行加解密,需要先有ID對應的key;"hex2bin&gpg"為先hex2bin在進行gpg加解密.
        $conf["enCodeType"]="gpg";
        #可省略參數:
        #$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".
        #$conf["sha1Raw"]="false";
        #$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.
        #$conf["p_hash"]="";
        #$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.
        #$conf["keyForAes256"]="";
        #$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.
        #$conf["aes256Encode"]="";
        #$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.
        #$conf["qbpwcfDecode"]="false";
        #$conf["gpgDecrypt"],字串,若"enCodeType"為"gpg",則預設為"false",代表加密;反之為"true",代表解密.
        $conf["gpgDecrypt"]="true";
        #$conf["gpgId"],字串,若"enCodeType"為"gpg"時,要使用的gpg id,預設為gnupgId.
        $conf["gpgId"]=$chooseIdByEmail;
        #參考資料:
        #sha1=>http://php.net/manual/en/function.sha1.php
        #md5=>http://php.net/manual/en/function.md5.php
        #password_hash=>http://php.net/manual/en/function.password-hash.php
        #password_verify=>http://php.net/manual/en/function.password-verify.php
        #json_decode=>https://www.php.net/manual/en/function.json-decode.php
        #備註:
        #無.
        $enCodeStr=authenticate::enCodeStr($conf);
        unset($conf);

        #var_dump($enCodeStr);

        #如果執行異常
        if($enCodeStr["status"]==="false"){

                #印出結果
                var_dump($enCodeStr);

                #結束執行,回傳 shell 1
                exit(1);

                }#if end
                
        #取得解密後的結果
        $input=$enCodeStr["content"];

        }#if end

#反之如果是要 encrypt
else if($decrypt==="off"){

        #函式說明:
        #加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,gpg,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$result["function"],當前執行的函數名稱.
        #$result["content"],加密後的結果.
        #$result["error"],錯誤訊息陣列.
        #$result["argu"],使用的參數.
        #必填參數:
        #$conf["enCodeStr"],any,要加密的字串,陣列,物件.
        $conf["enCodeStr"]=$input;
        #$conf["enCodeType"],"字串",加密或編碼的類型,有"sha1"與"md5"與"p_hash"與"aes256"與"qbpwcf"與"bin2hex"與"hex2bin"與"gpg"與"hex2bin&gpg",9種,"sha1"較耗時;"md5"較快;"p_hash"適用於密碼加密;"aes256"是對稱式加解密;"qbpwcf"是透過json_encode、urlencode、base64_encode的結果;"bin2hex"是依照每個byte的整數數值轉成"00"~"FF"後的結果,反之為"hex2bin";"gpg"是應用gpg進行加解密,需要先有ID對應的key;"hex2bin&gpg"為先hex2bin在進行gpg加解密.
        $conf["enCodeType"]="gpg";
        #可省略參數:
        #$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".
        #$conf["sha1Raw"]="false";
        #$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.
        #$conf["p_hash"]="";
        #$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.
        #$conf["keyForAes256"]="";
        #$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.
        #$conf["aes256Encode"]="";
        #$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.
        #$conf["qbpwcfDecode"]="false";
        #$conf["gpgDecrypt"],字串,若"enCodeType"為"gpg",則預設為"false",代表加密;反之為"true",代表解密.
        $conf["gpgDecrypt"]="false";
        #$conf["gpgId"],字串,若"enCodeType"為"gpg"時,要使用的gpg id,預設為gnupgId.
        $conf["gpgId"]=$chooseIdByEmail;
        #參考資料:
        #sha1=>http://php.net/manual/en/function.sha1.php
        #md5=>http://php.net/manual/en/function.md5.php
        #password_hash=>http://php.net/manual/en/function.password-hash.php
        #password_verify=>http://php.net/manual/en/function.password-verify.php
        #json_decode=>https://www.php.net/manual/en/function.json-decode.php
        #備註:
        #無.
        $enCodeStr=authenticate::enCodeStr($conf);
        unset($conf);

        #如果執行異常
        if($enCodeStr["status"]==="false"){

                #印出結果
                var_dump($enCodeStr);

                #結束執行,回傳 shell 1
                exit(1);

                }#if end
                
        #取得加密後的內容
        $input=$enCodeStr["content"];

        }#if end
        
#參數 decrypt 的內容異常 
else{

        #顯示help
        help();
        
        #結束運行
        exit;

        }#else end

#如果要輸出 hex 格式的內容 且為解密
if($outputHexWhenEncrypt==="on" && $decrypt==="off"){

        #函式說明:
        #加密或編碼字串,可以用的方法有sha1,md5,password_sha,qbpwcf,bin2hex,hex2bin,gpg,sha1可以回傳20或40的數值字串,md5可以回傳32個數值字串,password_hash可以回傳60~255個字元.
        #回傳結果:
        #$result["status"],執行是否正常,"true"代表正常,"false"代表不正常.
        #$result["function"],當前執行的函數名稱.
        #$result["content"],加密後的結果.
        #$result["error"],錯誤訊息陣列.
        #$result["argu"],使用的參數.
        #必填參數:
        #$conf["enCodeStr"],any,要加密的字串,陣列,物件.
        $conf["enCodeStr"]=$input;
        #$conf["enCodeType"],"字串",加密或編碼的類型,有"sha1"與"md5"與"p_hash"與"aes256"與"qbpwcf"與"bin2hex"與"hex2bin"與"gpg"與"hex2bin&gpg",9種,"sha1"較耗時;"md5"較快;"p_hash"適用於密碼加密;"aes256"是對稱式加解密;"qbpwcf"是透過json_encode、urlencode、base64_encode的結果;"bin2hex"是依照每個byte的整數數值轉成"00"~"FF"後的結果,反之為"hex2bin";"gpg"是應用gpg進行加解密,需要先有ID對應的key;"hex2bin&gpg"為先hex2bin在進行gpg加解密.
        $conf["enCodeType"]="bin2hex";
        #可省略參數:
        #$conf["sha1Raw"],字串,sha1加密的結果要用20個0與1組合還是要用40位數的16進位數值,"true"代表前者,"false"代表後者,預設為"false".
        #$conf["sha1Raw"]="false";
        #$conf["p_hash"],字串,p_hash加密過後的字串,該參數若存在且$conf["enCodeType"]為"p_hash",則代表是要檢查$conf["enCodeStr"]是否為符合$conf["p_hash"]的密碼.
        #$conf["p_hash"]="";
        #$conf["keyForAes256"],字串,用來 AES256 加解密的金鑰.
        #$conf["keyForAes256"]="";
        #$conf["aes256Encode"],字串,"true"代表是要加密,"false"代表是要解密.
        #$conf["aes256Encode"]="";
        #$conf["qbpwcfDecode"],字串,若"enCodeType"為"qbpwcf",則預設為"false",代表加密;反之為"true",代表解密.
        #$conf["qbpwcfDecode"]="false";
        #$conf["gpgDecrypt"],字串,若"enCodeType"為"gpg",則預設為"false",代表加密;反之為"true",代表解密.
        #$conf["gpgDecrypt"]="false";
        #$conf["gpgId"],字串,若"enCodeType"為"gpg"時,要使用的gpg id,預設為gnupgId.
        #$conf["gpgId"]="";
        #參考資料:
        #sha1=>http://php.net/manual/en/function.sha1.php
        #md5=>http://php.net/manual/en/function.md5.php
        #password_hash=>http://php.net/manual/en/function.password-hash.php
        #password_verify=>http://php.net/manual/en/function.password-verify.php
        #json_decode=>https://www.php.net/manual/en/function.json-decode.php
        #備註:
        #無.
        $enCodeStr=authenticate::enCodeStr($conf);
        unset($conf);

        #如果執行異常
        if($enCodeStr["status"]==="false"){

                #印出結果
                var_dump($enCodeStr);

                #結束執行,回傳 shell 1
                exit(1);

                }#if end
                
        #印出結果
        $input=$enCodeStr["content"];

        }#if end

#印出結果
echo $input;