![]() |
|
E-Learning Center « E-Learning tutorials and competitions. » |
![]() |
|
Share | Thread Tools | Search this Thread |
![]() |
#1 |
Super Moderator
Last Online: 08-01-2019
Join Date: May 2006
Posts: 5,580
Thanks: 1,888
Thanked 2,653 Times in 1,593 Posts
Groans: 55
Groaned at 35 Times in 32 Posts
|
![]()
ok, i had the idea of making a new challenge, today, and i wanted you first to go step by step, so that you will be able to participate in larger numbers.
from this pdf file i will paste here only what u need to be able to solve the challenge that i will give you later on. for now, please read the following, and if u have a question, please ask here. How To base64 Encryption Base 64 data representation is based on a 64-character alphabet. The alphabet is shown below 0 … 25 -> ‘A’ … ’Z’ 26 … 51 -> ‘a’ … ‘z’ 52 … 61 -> ‘0’ … ‘9’ 62 -> ‘+’ 63 -> ‘/’ A binary file is a series of zero and ones. If you grouped those zeros and ones in sets of 6, then you would get a number between 0 and 63 for each set. Converting them using the base64 alphabet allows you to convert binary zeros and ones into a compressed and human readable format. By compressed, I mean that you can represent six bits with one character. This is six times less than representing each bit with a ‘0’ or ‘1’ character. Let me present you with a simple example of converting a small binary string into base 64 notation. ‘001100110011’ This 12-bit binary string can be divided into two sets of 6 bits. ‘001100’ & ‘110011’ If you convert the 6-bit binary number to base-10 notation, the notation understood by you and me, then you get 12 and 51. 0 × 32 + 0 × 16 + 1 × 8 + 1 × 4 + 0 × 2 + 0 × 1 = 12 1 × 32 + 1 × 16 + 0 × 8 + 0 × 4 + 1 × 2 + 1 × 1 = 51 Now if you look up 12 and 51 in the base-64 alphabet, they are ‘M’ for 12 and ‘z’ for 51. So we can effectively represent this binary sequence in two human readable characters ‘Mz’. Most computers group binary files in sets of 8 bits, called a byte. The problem with this grouping is that it cannot be represented in one character and also be human readable. Often bytes are represented in the hexadecimal data representation format (or set of 4-bits) that is maybe a little more human readable than base-64, but also slightly less space efficient. The binary string ‘000111000111’ would be ‘1C7’ in hexadecimal notation, or three hexadecimal characters. The equivalent base-64 notation is ‘HH’, only two base-64 characters. So, as you can see, base-64 has a special efficiency (compression) advantage over the more popular hexadecimal notation. Padding The base-64 data representation method does have one failing, not present in the hexadecimal notation. Hexadecimal can efficiently represent a byte using exactly two hexadecimal characters, whereas base-64 cannot efficiently represent one byte of data. Since computers generally organize data into sequences of bytes, the base-64 requires some additional rules when a sequence of bytes cannot be efficiently represented. Groups of 3 bytes can efficiently be represented by reorganizing the bytes into 4 base-64 characters. Let’s take a sample 3 bytes sequence to demonstrate this fact. ‘01010101’ ‘00100100’ ‘00010001’ In hex this number would be ‘552411’. If you regroup these 3 bytes into series of 6-bits, then you get exactly four groups of 6-bits. ‘010101’ ‘010010’ ‘010000’ ‘010001’ In base-64 this representation is ‘VSQR’. Again, this is perfectly efficient, because I groups 3 bytes into 4 base-64 characters. So, whenever a binary sequence is exactly divisible by 3 bytes, then the representation in base-64 is efficient. In the case where a binary sequence is not an integral size of 3 bytes, then you have a representation problem. There are two cases to consider. When after regrouping each series of 3 bytes as 4 base-64 characters, you will have zero, one or two bytes left over. The problem occurs in the cases where you have one or two bytes remaining. How do you represent these instances? Let’s consider each case separately. The first case where you have one byte remaining, you should pad two additional bytes with all zeros onto the end of the binary sequence. You can then represent the one byte with two base-64 characters followed by two padding characters. The padding character in base-64 is ‘=’. Let consider an example. ‘00000001’ Pad the single-byte instance with two more bytes of zeros. ‘00000001’ ‘00000000’ ‘00000000’ Now break up the binary sequence in sets of six bytes. ‘000000’ ‘010000’ ‘000000’ ‘000000’ Take the first two base-64 characters and pad two ‘=’ characters to the end of the sequence. ‘AQ==’ The second case is where you have two bytes remain. ‘00000010’ ‘00000001’ Here you should pad one additional zero byte to the end of the binary sequence. ‘00000010’ ‘00000001’ ‘00000000’ Now break up the binary sequence in sets of six bytes. ‘000000’ ‘100000’ ‘000100’ ‘000000’ We then take three base-64 characters and pad with one ‘=’ sign. ‘AgE=’ it is not a long article ![]() remember that there is an upcoming challenge about this, and u will like it. for any question "why did we do that".. ask here. disclaimer: i'm no way an expert in encryption, i just faced a challenge and solved it by reading this. okay? ![]() ![]() ![]() ![]()
__________________
click on 'Groan' to switch to my left testicle. |
![]() |
![]() |
![]() |
#2 |
Super Moderator
Last Online: 08-01-2019
Join Date: May 2006
Posts: 5,580
Thanks: 1,888
Thanked 2,653 Times in 1,593 Posts
Groans: 55
Groaned at 35 Times in 32 Posts
|
![]()
can i get some "I understood the article and i'm ****ing ready for the challenge" ??
![]() ![]() ![]()
__________________
click on 'Groan' to switch to my left testicle. |
![]() |
![]() |
![]() |
#3 |
Registered Member
Last Online: 02-15-2012
Join Date: Oct 2007
Posts: 1,301
Thanks: 1,291
Thanked 663 Times in 428 Posts
Groans: 4
Groaned at 0 Times in 0 Posts
|
![]()
I got the first part very well..
and I understood the second part as well, but it seemed shway somplicated to me..... thanks for the article, and waiting for the challenge ![]() Last edited by MARX ®; 07-04-2008 at 11:27 AM. Reason: spelling mistake |
![]() |
![]() |
![]() |
#4 |
Super Moderator
Last Online: 08-01-2019
Join Date: May 2006
Posts: 5,580
Thanks: 1,888
Thanked 2,653 Times in 1,593 Posts
Groans: 55
Groaned at 35 Times in 32 Posts
|
![]()
can u tell me where is the complication, so that i can explain to you.
__________________
click on 'Groan' to switch to my left testicle. |
![]() |
![]() |
![]() |
#5 | |
Registered Member
Last Online: 02-15-2012
Join Date: Oct 2007
Posts: 1,301
Thanks: 1,291
Thanked 663 Times in 428 Posts
Groans: 4
Groaned at 0 Times in 0 Posts
|
![]() Quote:
in the examples, i didnt know keef tol3o l results |
|
![]() |
![]() |
![]() |
#6 |
Last Online: 05-30-2013
Join Date: Jan 2008
Posts: 1,788
Thanks: 10,018
Thanked 1,100 Times in 651 Posts
Groans: 1
Groaned at 6 Times in 6 Posts
|
![]()
Ok, I'll answer you...
when you divide a number by 3, there are 3 possibilities, either you have 0 as remainder or 1 as remainder or 2 as remainder... In our situation, when the remainder is 0 we don't have problem (the number was completely divisible by 3...) We only have problem when the remainder is either 1 or 2... in these two cases we have to add padding symbol (=)... Let's first take the case when we have 1 byte remaining... Taking the same example ‘00000001’... This byte is the remaining byte... We add two zero bytes... We obtain: ‘00000001’ ‘00000000’ ‘00000000’ Taking each 6 bits alone gives us: ‘000000’ ‘010000’ ‘000000’ ‘000000’ Now you have to use the calculator to know what these binary numbers represents in decimal... ‘000000’ is 0 ‘010000’ is 16 The first letter in alphabet is A so ‘000000’ is A... The letter number 17 in the alphabet is Q so ‘010000’ is Q... Here we are taking A and Q as capital letters because of this classification: 0 … 25 -> ‘A’ … ’Z’ 26 … 51 -> ‘a’ … ‘z’ 52 … 61 -> ‘0’ … ‘9’ 62 -> ‘+’ 63 -> ‘/’ Now the last two bytes we replace them with the padding symbol (=). So the answer will be AQ== The second case when we have 2 bytes remaining... Taking the same example ‘00000010’ ‘00000001’, these two bytes are the remaining bytes... We add to them 1 zero byte... We obtain: ‘00000010’ ‘00000001’ ‘00000000’ Taking each 6 bits alone gives us: ‘000000’ ‘100000’ ‘000100’ ‘000000’ Also using the calculator we convert these binaries to decimal... ‘000000’ is 0 ‘100000’ is 32 ‘000100’ is 4 The first letter in alphabet is A so ‘000000’ is A... The number 26 is a, going till 32 to get the letter g... so ‘100000’ is g... The letter number 5 in the alphabet is E so ‘000100’ is E... Now the last byte we replace it with the padding symbol... So the answer will be ‘AgE=’ ![]() |
![]() |
![]() |
The Following User Says Thank You to Google For This Useful Post: | MARX ® (07-04-2008) |
![]() |
#7 | |
Registered Member
Last Online: 02-15-2012
Join Date: Oct 2007
Posts: 1,301
Thanks: 1,291
Thanked 663 Times in 428 Posts
Groans: 4
Groaned at 0 Times in 0 Posts
|
![]() Quote:
bas fi something left, the padding sign, when we add it? sry 3am 3azzbak ma3e ![]() |
|
![]() |
![]() |
![]() |
|
Tags |
base64, encryption, prechallenge |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
|
|