3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function _xor($text,$key){ $outText = ''; for($i=0;$i<strlen($text);) { for($j=0;($j<strlen($key) && $i<strlen($text));$j++,$i++) { $outText .= $text{$i} ^ $key{$j}; } } return $outText; } $encoding_key = 'c422fdd0d81f'; // Encoding key and integrity key will $integrity_key = 'fe3fd7dd8731'; // be exchanged between you and Improve Digital $algo = 'sha1'; // HMAC algorithm used $price = 300; // Price to be encrypted. Up to 8 Bytes, treated as string // 1. Create a (hopefully) unique 16-byte initialization string: // This is an example and can be replaced by something faster if needed $initialization_vector = substr(hash("sha256", microtime(TRUE).rand(0,9999).time()),0,16); // 2. Encrypt the price: // The encrypted price is the result of a bitwise XOR (^) of the price and a HMAC-Hash of // the initialization string and the encoding key. Since xor does not bloat or shrink the // encrypted string, we are already changing the input to 8 bytes. // // Common pitfalls: // - Price to be encrypted MUST be a string. It will most likely behave unexpected if // treated as float // - Hash has to be RAW output (TRUE Parameter). If missed out, lowercase hexits will be // used and cause decryption to fail. $encrypted_price = _xor( substr(number_format($price,8),0,8), hash_hmac($algo, $initialization_vector,$encoding_key, TRUE )); // 3. Create the integrity // Another hash to be created to allow verification of the decrypted price. Integrity // key instead of encryption key is used // Only the first 4 Bytes are being used so the rest is omitted immediately. $integrity = substr(hash_hmac($algo, substr(number_format($price,8),0,8).$initialization_vector, $integrity_key, TRUE),0,4); // 4. Glue the parts togetger // 16 byte initialization string + 8 bytes encrypted price + 4 bytes of integrity will be // base64-encoded $out = base64_encode($initialization_vector.$encrypted_price.$integrity); // 5. Replace / with . and + with - to make the encoded string URL-safe. $urlsafe = str_replace('/','.',str_replace('+', '-', $out)); echo $urlsafe; // Done
Output for 7.1.0
MmFmMjhlOGFlMjNiMTdhZDgg9W94wv6nXt3gWg==
Output for 7.0.14
YmYxNWFiZjU3ZTcwYzBlY3P2.8V6A0SkAMrlTw==
Output for 7.0.11
Y2NlZDM3YWM1OGQ0MWZjZeWPSRiQD3zG29epaw==
Output for 7.0.10
OGM1YmU0OTg2YmIxZTA5ZUgbAWJnT6jgByYuoQ==
Output for 7.0.9
OTc3YzAyOTVmMzg4NWZhNsyG6VbDEF3DsTkh2w==
Output for 7.0.8
NTIyOGQ3NDczODYxMTI3NQipC64BGBmWU20ndg==
Output for 7.0.7
MDg3YmViNjFkNzkxNTE4OCfewN8zC390FM6E7A==
Output for 7.0.6
OGE5M2ZlMGNhODI2MWFlNTcWO.5a6zNkg5WpkQ==
Output for 7.0.5
MmE1MGJhYzVhYWM3MzA3OV6YpQTPGzoIr0uzVg==
Output for 7.0.4
ZGJlOThmNDkyYjRkNmFiMG1bVUE7Zp8gh6PctQ==
Output for 7.0.3
MTExMzE2MDU4NDk4MTQ2M8JurBWoB1Sj-ZIfiA==
Output for 7.0.2
ZDFiMjgwODA1OTE2NWIzYuYg2cIE-P8wbukDnA==
Output for 7.0.1
MmFiOWU3NzdjYjVkOTg1N2ZEpxjDyW-IKzdGfg==
Output for 7.0.0
M2RjMTEzY2M2MWM1NzNjNmN4vqXrM3PIo86AMA==
Output for 5.6.28
MTA5MjNlNjY0YWY5MjlkNT5e3WT0a93PpWdW.g==
Output for 5.6.26
OTI0NTI5NjIyNjU4ZmIxY0RIbapM9V6yWCsEzA==
Output for 5.6.25
NGNjN2RmMjE0NDhkYjNhYQtLTeNbe8YVf42.TA==
Output for 5.6.24
Y2Y3NzMyNjI0NzAxYTkxZeYUVJKXJbNTQc6QhA==
Output for 5.6.23
ODBjZmIyOGY3ODIzNWE5NXA9sVIsWP7K0er1Lg==
Output for 5.6.22
ODNhZmZiYmI1YjNhNDEyNjC6poOEdvMbMc.SWg==
Output for 5.6.21
MGNmMzMxOTU5ZTU1NWQ1Zv-KB6.5PWmThzWpVA==
Output for 5.6.20
ODI5MmFmNTI4MzRjYzc4MUKzaMUPHz6FAWqxMw==
Output for 5.6.19
YTg3MTk5ZTgxNWE0MzA3ZO1bYZsVLVBOB1oDfg==
Output for 5.6.18
Y2JiMmE1YThhODg1ZmYwMx95-3ebLcAyP1RiQg==
Output for 5.6.17
M2JkZTExMTQ5MmNjYzQ2ZoZqGiM-JxyPlcsffg==
Output for 5.6.16
MzhlNWJhY2Q5YjlhZjRkNsi4tg7TMTYU1U3KNg==
Output for 5.6.15
MDRhYWMyMGQ2ZTdlZDU3N1UN.2kzXav4qHODwg==
Output for 5.6.14
MTNkYTQ2ZDM0ZDY0ODNjMDXhj-wJ.NM4wmhWFw==
Output for 5.6.13
NTk0NTE1YzlkOWYzNWE1NHFlZE.uMXRotgVAAA==
Output for 5.6.12
ZjQyNWRhMTU1M2U0Y2I0M-22m2AqFuhbdHrV8g==
Output for 5.6.11
NGU0ZWQxZmE2ZjlkYzM0N4hu9hl6IIaq4JVK-g==
Output for 5.6.10
NmFmOGI4Y2Q1N2Q5ZDI0MnJJUNEsNZekVrtfIQ==
Output for 5.6.9
YWNkNGVhMWE5NGZkOTdlORPHXQDYtA-BJKaOPA==
Output for 5.6.8
MWNmMDhhMGQ4YjIxZWIxNM9JUhxEnikvLpdrfw==
Output for 5.6.7
MjQzOWUwYWYzYzVkMjQ1NsHW7-CTwJr8xJF8Lg==
Output for 5.6.6
NjE5ODM3ZDk5OGIwYWRlMQvl.LKAQ8MGLjpdRQ==
Output for 5.6.5
ZDE3MzlmYTUxYzJkZjRmMm4YgCJ10H9qGeCqsw==
Output for 5.6.4
ZTBkMjFiY2NiYzc0ZjM4Mv3zW25iSBtTQYuKtA==
Output for 5.6.3
YjY0ODdhN2I1MDA1MjFkZQc-wup8o9UW5yPf7A==
Output for 5.6.2
NWZjZjY4YmZjZDg0ODQ2MmY1P1LuTAp0jj7Omw==
Output for 5.6.1
ODZmMWNhMGRmZmEwNWI4Ngg5EGv60fm3GawkPw==
Output for 5.6.0
MzZkMjhlNzM4NmJlMThlY6BetJQ54ybSBI88OA==
Output for 5.5.38
ZGU3MjI3Mjk1NGYxNGZjZZof6gFY8d88MzpjdQ==
Output for 5.5.37
YzE1ZTc1ZTU1NDVjN2Q3Y62C3lP.E6kyZy8DOQ==
Output for 5.5.36
MTYyNzU3ZmY2MDcwNTE0Y25qBa-o7H.M2NCkig==
Output for 5.5.35
ODZiZjU1OWJlNjczMjVlNp1Jny1icv3tt81dKA==
Output for 5.5.34
ZjAyYmU2M2ZlMzQ5MWM2Ngsalb5Gy.E3S1k-Qg==
Output for 5.5.33
MTkyODU1ZDJkOTEzYTQxM3c4XJpJjA.28bTtbw==
Output for 5.5.32
MWM5YTE1ZGU1OWI1MzUzZO423NQfIOSWPSGbXg==
Output for 5.5.31
Y2MwMGEwZTJhZDk1OGUzNewwhMaV7z6DXK3NVA==
Output for 5.5.30
OWM4ODI3NmI3YTdjYTM3Nw6hbF44qQRhXT8x6w==
Output for 5.5.29
MTBkNmY1YmZhOTdhNWEzZmW5wcs2vwQL8M-AkA==
Output for 5.5.28
ZTRjZGY5NGNkMWMyMmNhNYtWVTLxPHYWamjxiQ==
Output for 5.5.27
N2JlZTdmNTI1NDQxYTRiZmyCxzi4ZFhIwL6Vrw==
Output for 5.5.26
MjAxYWJmZWM1YjU2MWJkZb-oIM.TImpnBHiW0A==
Output for 5.5.25
NWJlMjk2YmNkZGNlYTI4MFxjNwgfVPArqQMNcQ==
Output for 5.5.24
NjZkNWZlZTA2MTViNDUzM-2NWSOVSF3GpzRyjA==
Output for 5.5.23
YzViYjMxOTMxNWNhNDFmMiD8lpB3qVZl6wvC5w==
Output for 5.5.22
YjMzNDI2OWQxODJkYTllY4Fk3fvnX-2-W1WqBA==
Output for 5.5.21
ZTdjODY3MzY0MWZkOTU2ZI7kO8tFD.OzVlD0dw==
Output for 5.5.20
YzkwMDhjZTJlMDM4Njg0MwtQhjkpQeoT1QiClw==
Output for 5.5.19
YzM1NjhmMjlhNTY0OWVlNFK4I5fYIXWWN9JFEw==
Output for 5.5.18
ZWE3NjJlNzA5OTk0NmEwMYmxZAOyzlrbCo5poQ==
Output for 5.5.16
ZGQwZDZkNzNiOGE2YmRmZIIosXdPaOgd4fvjmA==
Output for 5.5.15
N2MxNTY3YzA1MWM4NTg4YQdinm.I4f6pc.RC3A==
Output for 5.5.14
NDUyYjFkNmZlMzZjODY1NSj1zYPhZukeNFDqFQ==
Output for 5.5.13
YzNjZTkwOGZhMGM5MzExZZWtwGva.1qC0CnZkA==
Output for 5.5.12
ZGUyMDI1NzBiMmUzZGFjOdl.x0SkXjy6-x1RXQ==
Output for 5.5.11
YjdkYzViZjdkMjc0OGYyZnc6Zs7x7PJHN.yGrg==
Output for 5.5.10
ODQ2MmZlYjJmODgxMThmOUX-YRK8Iyp-erflhA==
Output for 5.5.9
ZDczNzQ0YThkODU2MDFiOePLwP7Eq5N-wYvdpA==
Output for 5.5.8
NzlkOTFhOTIxNWM1OWRhM5M7aQupx03PHMU6sQ==
Output for 5.5.7
NWE3N2ZhZjRhYjRhNDE2NoVpBfPEhS4uri.Dcw==
Output for 5.5.6
ODFjNWFhYjMwYTY4Mjk3YaZm7ibj6r8ZAedy3w==
Output for 5.5.5
MzQ0NjNhNjQyYjEzNDdmNvdTWYlbrF67Z0TO4Q==
Output for 5.5.4
MTYyNmZjY2MwZjc1ZTI2NhW2BKNcH0ayhSD6EA==
Output for 5.5.3
ZTUyYWJiYWVlZjY4Y2MwN6q5N-d5.OqiZX7U-w==
Output for 5.5.2
YjliN2NhMTY2ODc2YjMxMbfp9md11FxfRTt9pw==
Output for 5.5.1
YTdhNTU3MDNjMTRhNmE0YevxXCOmNwObeVSqAw==
Output for 5.5.0
MjM4N2YzOGQxMjEzNTI5NMccAVnXcgeTb4UeXw==
Output for 5.4.45
NjIzMmE3ZDEzNzQwODA1N9NDi.PGXexAGoLdCg==
Output for 5.4.44
MDY5ZGJlYWUxMzc4OGY2MG4eJf-3JQlhdGQXBg==
Output for 5.4.43
MDQ2YTM3Y2UzOWI2YzEzMch5Lj8B.VD-M5wChQ==
Output for 5.4.42
MTFkYTgyYjUxMDA0Zjk1Y5pSEXJBzH8U6UxSdg==
Output for 5.4.41
MjFlYTBlODhhNGFhODYxZNgjo5.mwGboEKvfnA==
Output for 5.4.40
NjdjOGY1ZmQyNTU4YWQ1Yosa-mUjfPqp9auMmw==
Output for 5.4.39
ZDdhZjliMjRmZTIxN2FiYoJS90lphy23VR8kBw==
Output for 5.4.38
YzQzOWYxM2U2N2Y3ZTE0YYGgdoZISv5.5BlSMQ==
Output for 5.4.37
NDMyZjgzYzM2NWIzMjc5ZsRft.iVVsfsWb6i7g==
Output for 5.4.36
MDJiMzQ2NTkyMWJlYzI0NQSzFkAJP7L9VwKTbw==
Output for 5.4.35
MTE4NDNmNTUzOGQ5YTQwNAuQtocpwK0DUCnYoA==
Output for 5.4.34
ZmJkZDM0MWMxNTc2Yjk3MhLagEQNrvTMJ1mwrQ==
Output for 5.4.32
NzBmNGQxYWFiNTlhYTNiNltqPZVpvj9WlCdbHQ==
Output for 5.4.31
YjJiNzM4MzFmNDMyZTAzZuIIhtnUuHh0MMH0Yg==
Output for 5.4.30
Yjg5NDRkYmFjNDFkMWIzNomI115LzQmuivAAAg==
Output for 5.4.29
OGIxODg1YThjZTNiNDQ4Y3iDujWeF291rADN.Q==
Output for 5.4.28
ZWViNTk2NmU1OTQxMjg5ZpWAVIQFxOobWg2Gaw==
Output for 5.4.27
ZjY1MzgzNjdkNzc0MGViOAOcxee-RaOLCQqT-Q==
Output for 5.4.26
YmU4OTA2ZWFkNTU5NmE3Yqwxk3-S-ywwWcQ4cg==
Output for 5.4.25
MmVlZjY5ZjUwNmJjMmRlM3dJKhORS-aZP0U8fw==
Output for 5.4.24
Y2QxYTQyYjMwMTIxODU3ZjziOoUu0wHokcvRSw==
Output for 5.4.23
NzM0YjE4NjA4NDJlYzczMXudFGbTW62E6VYvZg==
Output for 5.4.22
MzgwODgxMDQ0NGFlNmJmZvEiOvsHGhtR-7PSlQ==
Output for 5.4.21
MDExNWRmZDhiNGU4Y2QwN7caG1bcbcNK9I6rVg==
Output for 5.4.20
ZGIyYzBiY2Y2MTNkODQ4NvnkUsydmJOdJ5uDGQ==
Output for 5.4.19
YTE0NzAxNzU2ZTNiMzVmZa8ueq1c60OtL.WlCw==
Output for 5.4.18
MzRhNjFkZmMwYWZjMmZlN301YFw.uCIlU1Od7Q==
Output for 5.4.17
MTc0NTNjZGFlNjc5MTI1MdoEJkfCfkv-wfWu5g==
Output for 5.4.16
MGQwN2NiYzBhMWRmNzM5ONO9mnmGJnh41P6AIg==
Output for 5.4.15
MzI5ODNmNzZiNGJkYjY2YxAsaJv3zzSycEfN3A==
Output for 5.4.14
YmU3NGJhY2Y3NjAzZGE4Ma7LU7kYq4zsJuQbOQ==
Output for 5.4.13
NDQxMDRlNDI0ZGE4ZTFkYUcS4-AhbZOmD6ZWVw==
Output for 5.4.12
YjRmYmE4YjU5OTQyYTM4Mu5KrsY5U.MARqnMBw==
Output for 5.4.11
ZWQzZDg4Y2QwZDc0NzQ1NlI-AiowNoMeVRO2dQ==
Output for 5.4.10
MjJjNDlhMzZlYzVlNDlmMmT4lKf4gnZ2i.0nHw==
Output for 5.4.9
ZGFjNmM5ZjhjMjA4ZGQ0Y2Hh1gqCFygYZPXn2A==
Output for 5.4.8
ZDlmMTY4NjlhZTk2NTNlMFohfPC9cIM0xGvjCg==
Output for 5.4.7
MzFhZDZjMTdkNjc1ZWMwNsB6ESNvltx-z.45IQ==
Output for 5.4.6
YTkxYTdlYTBhMzMzZTY3OW-Gpo.heKQ1wRCloQ==
Output for 5.4.5
M2NkODM1MjlmNGFiZDMwYdsH3ys-jQ7GpBE9mQ==
Output for 5.4.4
OGU5NmU5Y2MzYjU0YmFjM6ttOrHvUETzfzBbTw==
Output for 5.4.3
ZDkxZjAzOWMwMGM5MWNmN-nVcRl3i3kizCtrsQ==
Output for 5.4.2
MmQ3MTlhN2RmNzQ3MTkyMYefq-eVOnz6WVxkBw==
Output for 5.4.1
OGZkYjdhNGFkZjMwZjQxMQmDdGg19rW01qxeCQ==
Output for 5.4.0
NDNiMTY0OThjNTY2NGEzOEPGaFDj-bVAuGqK0Q==
Output for 5.3.29
YzVjM2YyYWEzNjMyZWM1Y5zt0y4K3DrxGdDy7A==
Output for 5.3.28
ODM0MjEyMDU2N2FlMTRlNhrAjxsW64NyTN0gtw==
Output for 5.3.27
YmZjNGQzZThhMzBkZTJmNKWjEYXgho8caZ2PWQ==
Output for 5.3.26
ODllNzUzZDIzN2I2YmE3MpL4chGMyyRzMpyNvg==
Output for 5.3.25
MTk1YzRmMTRhYTZjM2Q1ONpDYAwP7ZLt4qjpRQ==
Output for 5.3.24
OTlhMmM1MWMzNmIwNWEyMFtcpM.vgnYyPVWvPA==
Output for 5.3.23
ODEzY2JjOWQ1OWE0MzJmZAkqsi7anNkPZEzDNA==
Output for 5.3.22
ZjVkN2NlZDA4Y2RhOWQxYlCwLujaz5hlcvwKNw==
Output for 5.3.21
MmM4ZWMzMDViYTYwMDI5ZLjR.TfAAWyGrZkiVw==
Output for 5.3.20
ZGU3ZGQ5ZDY5MWQ0MjZmMLFnm0UVs-drUXfwGQ==
Output for 5.3.19
N2ViODc1NDg0NzRhZWVmMyBOlkgMDGZvbfyTPA==
Output for 5.3.18
ZDZlMTIyZDBjNjFkZTdlYmaW14WVXJO1YsyJig==
Output for 5.3.17
YjBmZDcwOWQzN2Y3MDA5N90RXSIPurVDpbvwag==
Output for 5.3.16
OTk3Mjc0YzNmNzExNDlkZmP0BuHzBWs9ebZO7Q==
Output for 5.3.15
MTVlZjEyYzJkZjdkNmU2NwRfebPNB9vAHzK5qQ==
Output for 5.3.14
NDBmZmM2MGFlOGIxMzRjNzSuIeHyzCG9Q7oJmw==
Output for 5.3.13
NjYwYmQxZGEyMTY0NTdhOTLIedrSzE2dETJsLw==
Output for 5.3.12
ZThmNTQ5MDgzMmQwMmI3OOkb7aVBchmfIIM5SA==
Output for 5.3.11
NDk2N2RkMmQxMTZmODE5MxgVu33mImqfvWTwWg==
Output for 5.3.10
YTI4MjZlYjkwMzAyYTAzOOy2grk2qppcvtHdxg==
Output for 5.3.9
NmQzYTBjMzE1OGU3OGNhOUyS8.Lndvq3Lrf7DA==
Output for 5.3.8
YzdkNGYzMDQ4ZTUwNDQ5Zjsljbg8bfZneiqrNw==
Output for 5.3.7
YThjOTdiZmI5Mjc5ZWE1MmPAQ0W.ZjdC3riWJQ==
Output for 5.3.6
OTVjZTFlMDdjODZhNDFkYlHUmRsFkQKC.Fj4zA==
Output for 5.3.5
MWYwZjk0MzM0ZGE4YmE4OcBRKpEGVec4GU7RBg==
Output for 5.3.4
YTQzMzViYzllYmQxMTFhNtakpb.ymYNS1.gdxw==
Output for 5.3.3
YWQ4MTQ4YmYwZmQwNDEyZhq9R60mWP90EBD-Kw==
Output for 5.3.2
MGZkMTlhZjc3M2JkOTg4OMBWfm9iirvVyaNzKA==
Output for 5.3.1
MTZlYWI0Y2ZjZTVlYmQ1MGEcru-eI62G6vc.Jg==
Output for 5.3.0
MGYwZTk3YzE3Yzg2ZTQyNlbECae8wdJYFVUN7Q==
Output for 5.2.17
ZDNiYjA1OTAyMWExZDQzNVibkIRALWSxLNZvyg==
Output for 5.2.16
YmI3M2NkMDc1YTI0YmJiMuduOnKnj1qkhLG5Ag==
Output for 5.2.15
YTZjMzBiYjMxMDAwMWQwYucLKrtN5qwtwlIUsQ==
Output for 5.2.14
NTE3NDYyNTQ1NzhkNmUwYhwO1nuS55hyLWBk5A==
Output for 5.2.13
NTUxOGJkNDEzYzE0MTVhNgUvF-ohEzsQMKI5Ag==
Output for 5.2.12
NGUwM2RlYjlkNTVmYjY4NEj4MjcLKmdzib.UFg==
Output for 5.2.11
YmJkZDUzOGJiYzE5NGMwMYOUFWaxqnIaziUmUw==
Output for 5.2.10
ZjVmYmIwYjY5MzdlZWUxY0NNn8oCpii4QOqBMg==
Output for 5.2.9
NjFjOTFmM2JjMmI0NDY4ZdFlWrzUQeYrld4PKw==
Output for 5.2.8
ZmVmZmEzNGY5YjgwZDFkYTCfga-jLE45SZuAVw==
Output for 5.2.7
N2RkNzg0MzdhOWMzZDU2Ob6eU0tkW4kA75cWhg==
Output for 5.2.6
MGE4NWMyMTNjZTQyMzdhZb3r.HNV9eNZJG313g==
Output for 5.2.5
ODBmNGJiMmQyN2Y3NjJjMVCad0b2ZxYWxOq7OQ==
Output for 5.2.4
NzI1Mzg2ZGRjNmY2MDgxMUmB.2ORXH9qA1x1Gw==
Output for 5.2.3
ODA5NjE5Mzc4YzY2Y2JkYkOsOtGuDSQ0jt-mUQ==
Output for 5.2.2
YzgwOTkzMWMzYjhjODg5ZRJgMGebBJcROjYzSg==
Output for 5.2.1
NGYwMjRmNDQyZDMyZTZmOMG-fb12IcGhlP7Dfw==
Output for 5.2.0
NjQ4YTI3M2Q1M2I1M2M0ZrTAjjqCaaiQjhbe4w==
Output for 5.1.6
MjcxYTIyYjZhYzllYzE4YTTxrSV6djrUyYHkBg==
Output for 5.1.5
NTg1ZWVmOTQ5N2EwYTY2N.TPcr4Q-1o9mlvyEA==
Output for 5.1.4
YmEyMDU2OWIzMzQ3MDZlNHBch44y-0RdInhOkw==
Output for 5.1.3
NzRiODlmYzJlN2UzNDQyOJMBgkT-WUGZDyVwfA==
Output for 5.1.2
MjYwNDEzZjliYjk1MzExMFEWsBlOhiXXB8TBMg==
Output for 5.0.0 - 5.0.5, 5.1.1
Fatal error: Call to undefined function hash() in /in/jjYon on line 17
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/jjYon on line 42
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: hash() in /in/jjYon on line 17
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: hash() in /in/jjYon on line 17
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: hash() in /in/jjYon on line 17