示例#1
0
function encryptUserInfo($user_id, $mobile)
{
    $output = "";
    // 2位随机字母
    $output .= genRandomString(2);
    // 用户id
    $output .= encryptNumToAlphabet(strval($user_id));
    // 分隔符
    $output .= 'z';
    // 用户手机号,以随机字母间隔
    $encryptMobile = encryptNumToAlphabet($mobile);
    for ($i = 0; $i < strlen($encryptMobile); $i++) {
        $output .= genRandomString(1);
        $output .= $encryptMobile[$i];
    }
    // 分隔符
    $output .= 'z';
    // 年月日时,以随机字母间隔
    $time = date("YmdH", time());
    $encryptTime = encryptNumToAlphabet($time);
    for ($i = 0; $i < strlen($encryptTime); $i++) {
        $output .= genRandomString(1);
        $output .= $encryptTime[$i];
    }
    // 2位随机字母
    $output .= genRandomString(2);
    return $output;
}
示例#2
0
 private function encryptExamId($examId)
 {
     $strExamId = (string) $examId;
     $len = strlen($strExamId);
     if ($len > 1) {
         $loopCount = rand(1, $len);
         for ($i = 0; $i < $loopCount; $i++) {
             $poz = rand(0, $len - 1);
             $strExamId[$poz] = encryptNumToAlphabet($strExamId[$poz]);
         }
     }
     return $strExamId;
 }
示例#3
0
文件: common.php 项目: NAMEs/Utility
function encryptId($id)
{
    $idStr = (string) $id;
    $len = strlen($idStr);
    if ($len > 1) {
        $loopCount = rand(1, $len);
        for ($i = 0; $i < $loopCount; $i++) {
            $poz = rand(0, $len - 1);
            $idStr[$poz] = encryptNumToAlphabet($idStr[$poz]);
        }
    }
    $shaStr = sha1($id * 3 + 1 . $idStr);
    $beginStr = substr($shaStr, 7, 10);
    $endStr = substr($shaStr, 23, 10);
    return $beginStr . $idStr . $endStr;
}