如何编码回这个字符串?
how to encode back this string?
当我尝试用
解码时,我已经编码了stirng
echo gzdecode(base64_decode('H4sIAAAAAAAACp1SW2/aMBT+L35dkzlOAk7eKujaMBIKhEEzTZVJDmByXeJcCOK/z2Gapr1VkyxZPue7HH/2FfEIMsHFBdlXVFdQOhGyETX24ZhaY4VqUagYQHTFiixNoVSzAAOLImKgB8RqcfLzGDJJgcvstH8O+YLPnE2/6Vw+s1RZ7IOd17OtVe9IEjvnnAfbVer232KPvAmPuDhYY7zYvhlzP8bBNBSL7VPrPnvJwncNr39qHd7yYHdqJbfzzkvTO8e66zv9fDIjwW5215a99rBUU/29LOLyy/uGzhcULG/q9X3Mupd1tem7CZ5ScOLktXnjFuRmZ26fosvxhc5js4l1c7kgSrqd1MdzdynWq0lofn085T9bedEIGh7CPRprZGg6NtkoGmE2JochhqK4t8I8VU95UUCppnmdCcazhkOrFgm7SFgDZcVzmdUVNSypQTJMdawS2drXPIm8Ot1DiWxNG1Eyvt0eUFHCAUrIQqgGVpKHLBloPHp3ppIW1uXQlW+HNuuhIHgKQZ4NmMeKs88zFrNSMCS1KtZA5AhIpdT369+jhE5YWXI5nBSoBBOSfUWCHe+bFJS1tJAwgglRsKFgy8dYTmljXdVG5ic8tjEeLNZ/NNe/VZCbV2IFofxgSF7nX9MVHGUYH/bUfKLbBrUxUXWN/qfnFA6sTsScZ/EHjDUFU4Vg/+4ll4ox/qjxj9svb1MDk1oDAAA='));
一切顺利,问题是我编码的时候,结果不工作
echo gzencode(base64_encode('{"identity":{"userId":"84bc7897-81dc-4e23-9d91-8819e0eadd24","authToken":"eyJhbGciOiJIUzUxMiJ9.eyJzZXNzaW9uX2lkIjoiZWRmMzVkN2YtN2M0ZS00OWY4LTk0ZDctOWEwMGNlOTM4NzEwIiwiZXhwIjoxNjQ5Njk3MTIzLCJ2ZXJzaW9uIjowfQ.m3_rpkrF_U8LO8e9NDNzzkaxHSsUzxC0D8eIklPvYi9eo5x5WEdygH8Lk5vk35QO2-mWCugjxypSRCc5KAhoqw","deviceId":"9641305a6d60a72f","appId":"com.hopper.mountainview.play","version":{"value":"5.7.2","buildNumber":116827}},"preferences":{"locale":"id_ID","currency":"USD","timeZone":"Asia/Jakarta"},"savedItems":[{"savedItem":"Carriers","state":{"tag":{"timestamp":"2022-04-09T00:11:03.165+07:00"},"SavedItemState":"MostRecent"}},{"savedItem":"Regions","state":{"tag":{"timestamp":"2022-04-01T23:48:02.318+07:00"},"SavedItemState":"MostRecent"}},{"savedItem":"DefaultLinks","state":{"tag":{"timestamp":"2021-08-20T07:00:00.000+07:00"},"SavedItemState":"MostRecent"}}]}'));
我得到了结果
S˒8%^y4%ڠi36n_1s=T%̬,Q-|Ԫ$WKYzi&0
~XpL@cqFX q-2q
如何工作好,如上
想想解码和编码都在做什么。如果您将每个操作分解为 2 个步骤,您将看到您做错了什么。
base64_decode() takes a string and returns binary data
gzdecode() decodes the binary data into a string
要逆向时,必须先逆向步骤和gzencode。
gzencode() the json string into binary data
base64_encode() the binary data into a string
所以要编码,您可以这样做:
base64_encode(gzencode('{"identity":...}'));
警告:您的输出包含无法显示的字符。在处理特殊字符或二进制数据时,确保在输出周围使用 utf8_encode。
试试这个 - 它对我有用
<?php
$text = gzdecode(base64_decode('H4sIAAAAAAAACp1SW2/aMBT+L35dkzlOAk7eKujaMBIKhEEzTZVJDmByXeJcCOK/z2Gapr1VkyxZPue7HH/2FfEIMsHFBdlXVFdQOhGyETX24ZhaY4VqUagYQHTFiixNoVSzAAOLImKgB8RqcfLzGDJJgcvstH8O+YLPnE2/6Vw+s1RZ7IOd17OtVe9IEjvnnAfbVer232KPvAmPuDhYY7zYvhlzP8bBNBSL7VPrPnvJwncNr39qHd7yYHdqJbfzzkvTO8e66zv9fDIjwW5215a99rBUU/29LOLyy/uGzhcULG/q9X3Mupd1tem7CZ5ScOLktXnjFuRmZ26fosvxhc5js4l1c7kgSrqd1MdzdynWq0lofn085T9bedEIGh7CPRprZGg6NtkoGmE2JochhqK4t8I8VU95UUCppnmdCcazhkOrFgm7SFgDZcVzmdUVNSypQTJMdawS2drXPIm8Ot1DiWxNG1Eyvt0eUFHCAUrIQqgGVpKHLBloPHp3ppIW1uXQlW+HNuuhIHgKQZ4NmMeKs88zFrNSMCS1KtZA5AhIpdT369+jhE5YWXI5nBSoBBOSfUWCHe+bFJS1tJAwgglRsKFgy8dYTmljXdVG5ic8tjEeLNZ/NNe/VZCbV2IFofxgSF7nX9MVHGUYH/bUfKLbBrUxUXWN/qfnFA6sTsScZ/EHjDUFU4Vg/+4ll4ox/qjxj9svb1MDk1oDAAA='));
echo utf8_encode($text);
当我尝试用
解码时,我已经编码了stirngecho gzdecode(base64_decode('H4sIAAAAAAAACp1SW2/aMBT+L35dkzlOAk7eKujaMBIKhEEzTZVJDmByXeJcCOK/z2Gapr1VkyxZPue7HH/2FfEIMsHFBdlXVFdQOhGyETX24ZhaY4VqUagYQHTFiixNoVSzAAOLImKgB8RqcfLzGDJJgcvstH8O+YLPnE2/6Vw+s1RZ7IOd17OtVe9IEjvnnAfbVer232KPvAmPuDhYY7zYvhlzP8bBNBSL7VPrPnvJwncNr39qHd7yYHdqJbfzzkvTO8e66zv9fDIjwW5215a99rBUU/29LOLyy/uGzhcULG/q9X3Mupd1tem7CZ5ScOLktXnjFuRmZ26fosvxhc5js4l1c7kgSrqd1MdzdynWq0lofn085T9bedEIGh7CPRprZGg6NtkoGmE2JochhqK4t8I8VU95UUCppnmdCcazhkOrFgm7SFgDZcVzmdUVNSypQTJMdawS2drXPIm8Ot1DiWxNG1Eyvt0eUFHCAUrIQqgGVpKHLBloPHp3ppIW1uXQlW+HNuuhIHgKQZ4NmMeKs88zFrNSMCS1KtZA5AhIpdT369+jhE5YWXI5nBSoBBOSfUWCHe+bFJS1tJAwgglRsKFgy8dYTmljXdVG5ic8tjEeLNZ/NNe/VZCbV2IFofxgSF7nX9MVHGUYH/bUfKLbBrUxUXWN/qfnFA6sTsScZ/EHjDUFU4Vg/+4ll4ox/qjxj9svb1MDk1oDAAA='));
一切顺利,问题是我编码的时候,结果不工作
echo gzencode(base64_encode('{"identity":{"userId":"84bc7897-81dc-4e23-9d91-8819e0eadd24","authToken":"eyJhbGciOiJIUzUxMiJ9.eyJzZXNzaW9uX2lkIjoiZWRmMzVkN2YtN2M0ZS00OWY4LTk0ZDctOWEwMGNlOTM4NzEwIiwiZXhwIjoxNjQ5Njk3MTIzLCJ2ZXJzaW9uIjowfQ.m3_rpkrF_U8LO8e9NDNzzkaxHSsUzxC0D8eIklPvYi9eo5x5WEdygH8Lk5vk35QO2-mWCugjxypSRCc5KAhoqw","deviceId":"9641305a6d60a72f","appId":"com.hopper.mountainview.play","version":{"value":"5.7.2","buildNumber":116827}},"preferences":{"locale":"id_ID","currency":"USD","timeZone":"Asia/Jakarta"},"savedItems":[{"savedItem":"Carriers","state":{"tag":{"timestamp":"2022-04-09T00:11:03.165+07:00"},"SavedItemState":"MostRecent"}},{"savedItem":"Regions","state":{"tag":{"timestamp":"2022-04-01T23:48:02.318+07:00"},"SavedItemState":"MostRecent"}},{"savedItem":"DefaultLinks","state":{"tag":{"timestamp":"2021-08-20T07:00:00.000+07:00"},"SavedItemState":"MostRecent"}}]}'));
我得到了结果
S˒8%^y4%ڠi36n_1s=T%̬,Q-|Ԫ$WKYzi&0 ~XpL@cqFX q-2q
如何工作好,如上
想想解码和编码都在做什么。如果您将每个操作分解为 2 个步骤,您将看到您做错了什么。
base64_decode() takes a string and returns binary data
gzdecode() decodes the binary data into a string
要逆向时,必须先逆向步骤和gzencode。
gzencode() the json string into binary data
base64_encode() the binary data into a string
所以要编码,您可以这样做:
base64_encode(gzencode('{"identity":...}'));
警告:您的输出包含无法显示的字符。在处理特殊字符或二进制数据时,确保在输出周围使用 utf8_encode。
试试这个 - 它对我有用
<?php
$text = gzdecode(base64_decode('H4sIAAAAAAAACp1SW2/aMBT+L35dkzlOAk7eKujaMBIKhEEzTZVJDmByXeJcCOK/z2Gapr1VkyxZPue7HH/2FfEIMsHFBdlXVFdQOhGyETX24ZhaY4VqUagYQHTFiixNoVSzAAOLImKgB8RqcfLzGDJJgcvstH8O+YLPnE2/6Vw+s1RZ7IOd17OtVe9IEjvnnAfbVer232KPvAmPuDhYY7zYvhlzP8bBNBSL7VPrPnvJwncNr39qHd7yYHdqJbfzzkvTO8e66zv9fDIjwW5215a99rBUU/29LOLyy/uGzhcULG/q9X3Mupd1tem7CZ5ScOLktXnjFuRmZ26fosvxhc5js4l1c7kgSrqd1MdzdynWq0lofn085T9bedEIGh7CPRprZGg6NtkoGmE2JochhqK4t8I8VU95UUCppnmdCcazhkOrFgm7SFgDZcVzmdUVNSypQTJMdawS2drXPIm8Ot1DiWxNG1Eyvt0eUFHCAUrIQqgGVpKHLBloPHp3ppIW1uXQlW+HNuuhIHgKQZ4NmMeKs88zFrNSMCS1KtZA5AhIpdT369+jhE5YWXI5nBSoBBOSfUWCHe+bFJS1tJAwgglRsKFgy8dYTmljXdVG5ic8tjEeLNZ/NNe/VZCbV2IFofxgSF7nX9MVHGUYH/bUfKLbBrUxUXWN/qfnFA6sTsScZ/EHjDUFU4Vg/+4ll4ox/qjxj9svb1MDk1oDAAA='));
echo utf8_encode($text);