Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Cookie.write = function (key, value, duration) {
- value=encrypt(value);
- Cookie.remove(key);
- var d = new Date();
- if (duration <= 0)
- duration = 1;
- d.setTime(d.getTime() + 1000 * 60 * 60 * 24 * duration);
- document.cookie = key + "=" + encodeURI(value) + "; expires=" + d.toGMTString() + ";path=/";
- };
- function encrypt(word)
- {
- var key = CryptoJS.enc.Utf8.parse("010216a654976158");
- var iv = CryptoJS.enc.Utf8.parse("010216a654976158");
- var src = CryptoJS.enc.Utf8.parse(word);
- var encrypted = CryptoJS.AES.encrypt(src, key, { iv: iv,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding});
- return encrypted.toString();
- }
- function decrypt(word)
- {
- var key = CryptoJS.enc.Utf8.parse("010216a654976158");
- var iv = CryptoJS.enc.Utf8.parse("010216a654976158");
- var decrypt = CryptoJS.AES.decrypt(word, key, { iv: iv,mode:CryptoJS.mode.CBC,padding:CryptoJS.pad.ZeroPadding});
- return CryptoJS.enc.Utf8.stringify(decrypt).toString();
- }
- $uidE = $_COOKIE["uid"];
- $decode = base64_decode($uidE);
- $pk ="010216a654976158";
- $iv ="010216a654976158";
- $value = '4';
- $encrypted = ( mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $pk, $value, MCRYPT_MODE_CBC,$iv) );
- $uid = (mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $pk, $decode, MCRYPT_MODE_CBC,$iv));
- echo base64_encode($encrypted);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement