Hackthissite.org programming 3
This is a little programming challange where you are supposed to reverse an encryptet text. This is easier than you would think.We get an example on how the keys could look like.
QGG-V33-OEM-0B1-1.1
Z93-Z29-OEM-BNX-1.1
IQ0-PZI-OEM-PK0-1.1
UM4-VDL-OEM-B9O-1.1
L0S-4R2-OEM-UQL-1.1
JBL-EYQ-OEM-ABB-1.1
NL1-3V3-OEM-L4C-1.1
7CQ-1ZR-OEM-U3I-1.1
XX0-IHL-OEM-5XK-1.1
KJQ-RXG-OEM-TW8-1.1
OZR-LW1-OEM-5EM-1.1
0B8-6K5-OEM-EFN-1.1
OE2-20L-OEM-SSI-1.1
0ME-HAE-OEM-9XB-1.1
(Don't forget the UNIX-style line breaks.)
Understanding evalCrossTotal()
This is the easiest, so we begin here. This method first does str_split($strMD5, 1); witch takes the string, and makes an array.Then you have this foreach method witch runs through the array and makes a sum of all the signs in the string. Here you much remember that the linebreak is "\n" and is used for in all the keys, except the last one.
If you don't know what value this is, it's the hex value of the sign.
Understanding encryptString()
First this makes one md5-hash from the $strPassword variable. Then getting the hex value of this hashcode combined. Since we know the last two signs of many of the keys on the example file is "\n", we can use this. We also use the fact that all the kays have "1.1" at the end.We then try to see what the whole thing will print (we just use an empty password for now), but we use the whole example list.
-176 -220 -170 -202 -136 -123 -163 -205 -157 -128 -160 -213 -149 -159 -199 -238 -161 -226 -183 -148 -113-152 -177 -116 -161 -148 -148 -158 -218 -125 -139 -108 -219 -202 -157 -186 -174 -144 -188 -155 -115 -111-143 -155 -225 -162 -177 -140 -154 -146 -184 -145 -116 -232 -184 -124 -153 -186 -160 -160 -149 -226 -130-160 -170 -163 -173 -136 -142 -153 -189 -155 -126 -168 -178 -99 -183 -200 -226 -175 -214 -109 -169 -105-148 -145 -192 -182 -144 -176 -170 -187 -142 -141 -166 -186 -121 -206 -164 -164 -163 -223 -164 -147 -102-157 -224 -169 -185 -156 -163 -192 -175 -144 -161 -141 -218 -144 -166 -120 -167 -173 -171 -186 -98 -173-159 -170 -130 -227 -201 -146 -152 -179 -108 -156 -153 -175 -213 -183 -163 -188 -159 -229 -203 -164 -139-155 -182 -162 -129 -185 -143 -192 -199 -180 -203 -175 -158 -159 -184 -150 -178 -157 -213 -157 -111 -147-178 -202 -169 -175 -143 -158 -134 -173 -90 -167 -169 -237 -167 -178 -140 -195 -158 -147 -166 -117 -146-145 -123 -157 -208 -181 -144 -163 -173 -115 -159 -196 -181 -183 -166 -206 -164 -199 -168 -163 -204 -90-158 -165 -146 -180 -196 -140 -156 -157 -141 -154 -155 -217 -145 -130 -192 -179 -153 -192 -214 -158 -135-154 -147 -125 -197 -227 -167 -207 -151 -181 -150 -170 -218 -159 -127 -171 -225 -173 -133 -193 -134 -153-185 -201 -146 -157 -160 -155 -170 -142 -150 -179 -93 -217 -177 -157 -146 -170 -172 -177 -209 -134 -150-154 -168 -182 -118 -191 -138 -206 -194 -167 -148 -161 -216 -147 -163 -179 -180 -158 -148 -207 -170 -141-185 -190 -186 -237 -119 -158 -194 -237 -146 -75 -134 -168 -192 -130 -223 -177 -209 -152 -189
The encrypted text given to me is:
-193 -166 -105 -222 -163 -99 -223 -206 -177 -146 -186 -155 -183 -157 -192 -198 -134 -184 -188 -207 -162 -140 -182 -152 -191 -183 -151 -208 -122 -134 -170 -169 -144 -164 -163 -189 -150 -224 -201 -221 -73 -175 -150 -112 -191 -145 -156 -205 -168 -132 -172 -166 -171 -166 -133 -187 -201 -195 -196 -210 -146 -164 -189 -179 -155 -113 -180 -192 -135 -182 -147 -207 -156 -172 -105 -190 -137 -219 -179 -234 -90 -189 -198 -175 -182 -146 -143 -119 -163 -178 -179 -177 -161 -172 -160 -173 -114 -200 -211 -264
Lets try the last serial, since we are just supposed to give the last one back, it's good to know how much you need to do: -185 -190 -186 -237 -119 -158 -194 -237 -146 -75 -134 -168 -192 -130 -223 -177 -209 -152 -189Just to the math, and you see that you are given 5 keys in the encrypted text for the mission. Then we need see how things are printed, to fully understand the code.
Check values:
We check the values by running one value at the time with an empty password