IN ARM ASSEMBLY Take a file of strings (Which may be binary data) and convert th
ID: 646400 • Letter: I
Question
IN ARM ASSEMBLY
Take a file of strings (Which may be binary data) and convert those string to a Base64 encoding.
The encoding scheme to use is the same as that used in rfc1421.
Base64 encoding is a process by which three binary characters are encoded and replaced with 4 text characters. Text characters include A-Z, a-z, 0-9,+,/ (these are all easily printable characters and don't pose any problems to communication software, such as email.) We also use the '=' to represent "padded" characters.
So... Three characters is three bytes, three bytes is 24 bits. But you are going to divide these 24 bits into 4 sets of 6 bits. 2^6 = 64, hence base "64" encoding.
The subsequence "ABC" in a string would have the ASCII values 65 (01000001), 66 (01000010), and 67 (01000011) for a total 24 bit sequence of 010000010100001001000011. Chunking this into 6-bits chunks yields... 010000 010100 001001 000011. As 4 numbers this is 16, 20, 9, and 3. in RFC1421 this equates to the replacement sequence "QUJD"
If the number of letters in a string is not divisible for 3 pad it with = signs.
So take a file of multiple strings, Encode each line in RFC1421 Base64 encoding and output that line to a new file.
THe input file is called "input.txt" the output file shall be named "output64.txt"
Each input line will be less than 1024 characters
Each line may include binary data but will not include carriage return (' ') or newline (' ').
Each line will be terminated by the two character end of line sequence (" ")
Explanation / Answer
Base64 is a group of similar binary-to-text encoding schemes that represent binary data in an ASCII string format by translating it into a radix-64 representation. The term Base64 originates from a specific MIME content transfer encoding.
Base64 encoding schemes are commonly used when there is a need to encode binary data that need to be stored and transferred over media that are designed to deal with textual data. This is to ensure that the data remain intact without modification during transport. Base64 is commonly used in a number of applications, including email via MIME, and storing complex data in XML.
The particular set of 64 characters chosen to represent the 64 place-values for the base varies between implementations. The general strategy is to choose 64 characters that are both members of a subset common to most encodings, and also printable. This combination leaves the data unlikely to be modified in transit through information systems, such as email, that were traditionally not 8-bit clean. For example, MIME's Base64 implementation uses A