|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: base64 byte-length formulaPat, I think you are talking about the formula in 12-96 and I am talking about the one in 12-98. Martins formula and mine are equivalent for good encodings. As I said I made it up only to account for encodings that are in fact impossible - like 1, 4 ... 4*n+1 base 64 digits. And I will put in Martins formula with a note about the impossible numbers. Can we stop this thread? Julo
Julian, The formula in 12-97 is: ((the integer part of)((n+3)*3/4) - m) Martins formula 3*3/4 where / indictates integer divide. The encoding of 1 octet in base64 results in 2 characters plus 2 equal signs. n=2, m=2. Martins formula = 2 *3/4 = 1 (truncated to an integer) right answer integer part of ((2+3)*3/4)-1 = (integer part of 15/4) - 2 = 3 - 2 = 1 right answer The encoding of 2 octets in base64 results in 3 characters plus one equal sign. n=3, m=1. Martins formula = 3 *3/4 = 2 (truncated to an integer) right answer integer part of ((3+3)*3/4)-1 = (integer part of 18/4) -1 = 4 - 1 = 3 wrong answer The encoding of 3 octets in base64 results in 4 characters plus no equal sign. n=4, m=0. Martins formula = 4 *3/4 = 3 (truncated to an integer) right answer integer part of ((4+3)*3/4)-1 = (integer part of 21/4) -0 = 5 - 1 = 4 wrong answer Pat -----Original Message----- From: Julian Satran [mailto:Julian_Satran@il.ibm.com] Sent: Wednesday, June 12, 2002 4:56 PM To: Martins Krikis Cc: ips@ece.cmu.edu; owner-ips@ece.cmu.edu Subject: Re: base64 byte-length formula I said already that your formula is correct. I do not understand why you say that the 2 formulas are not equivalent for all the lengths (good aor bad)? I would appreciate if you respond although you don't have to. Julo Martins Krikis <mkrikis@yahoo.com> Sent by: owner-ips@ece.cmu.edu 06/13/2002 02:34 AM Please respond to Martins Krikis To: Julian Satran/Haifa/IBM@IBMIL cc: ips@ece.cmu.edu Subject: Re: base64 byte-length formula --- Julian Satran <Julian_Satran@il.ibm.com> wrote: > The difference between our formulas is that I > (mistakenly) took 1 digit as > a possible string (or 5, 9 etc.) > For those you need the +3 TERM. > > For all the good length 2,3,4 6,7,8 etc the two > formulas are equivalent. No they are not. They are only equivalent for n = 0 (mod 4). So I'm still insisting that n * 3 / 4 is the simplest right formula. Martins Krikis, Intel Corp. Disclaimer: these are my opinions and may not be Intel's. __________________________________________________ Do You Yahoo!? Yahoo! - Official partner of 2002 FIFA World Cup http://fifaworldcup.yahoo.com
Home Last updated: Thu Jun 13 13:18:41 2002 10757 messages in chronological order |