![]() |
| ||
| Encoding help, run into block. Hey, im trying to make an assembly program which encodes a file using base64. Anyway I have a program that works in converting the word "Man" to TWFu. Problem is it does not convert anything else but a few 3 letter words like Tan and Ban probally because of its similarity with Man. Below is a code snippet I am using to run the encode, taking 3 bytes from the read file and converting it to 4 bytes writing it to the file then grabbing another 3 bytes and doing the same thing. If anyone could help me figure out what I am doing wrong here help would be appreciated. I am completely stumped at this point and spent the weekend stuck on this one issue. By the way this is x86 Assembly code, 16 bit. I am using Masm as my compiler. Encode64: |
| ||
| Re: Encoding help, run into block. I'm not sure exactly what problems you are having, but the stuff following B4 has some errors. First, if you only want to clear the top two bits of AL then shl al, 2shr al, 2Or, even simpler: and al, 3FhAlso, you only add 61 to it instead of 65 as you did in all the others. You are aware, I presume, that simply adding 'A' doesn't account for three things: punctuation characters between A..Z and a..z, a control character (ASCII 127), and the fact that you exceed the ASCII character range by one character (your domain is 65..128, while ASCII is only defined on 0..127). You would do better to use a lookup table for ASCII digits and use the xlat instruction to convert AL. Hope this helps. |
| ||
| Re: Encoding help, run into block. Quote:
|
| ||
| Re: Encoding help, run into block. Great. When you are ready to go the other way, you can use rep scasb to look for an item in the table, and subtract the difference between the location of the item in the table and the beginning of the table to get the index of the item. Hope this helps. |
| ||
| Re: Encoding help, run into block. Thanks~ Definately helps, I was able to make a working program that perfectly encodes into Base64 100% of the time. As for decoding I decided to start working on it soon, thanks for the tip on how to go the other way! |
| All times are GMT -4. The time now is 2:52 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC