Commit 46c28d92 authored by clone's avatar clone

加密

parent 91d8b242
<?php
namespace app\api\untils;
/**
* Created by PhpStorm.
* User: zw
* Date: 2019/3/12
* Time: 17:02
*/
class CouponNoEncodingUntils{
const OR_NOT_VALUE = 123123123123;
private function reverse($s){
return strrev($s);
}
public function encryptionCouponNo($couponNo){
$couponNo = $this->reverse($couponNo . "1");
return $couponNo ^ self::OR_NOT_VALUE;
}
public function decryptionCouponNo($couponNo){
$couponNo = $couponNo ^ self::OR_NOT_VALUE;
return substr($couponNo,-1);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment