final php versions of fwPack and fwUnpack

Mark Brownell gizmotron at earthlink.net
Thu Mar 4 16:32:44 EST 2004


On Wednesday, March 3, 2004, at 07:18  PM, Richard Gaskin wrote:

>>> For example, we hear about 128-bit encryption, but I couldn't find a  
>>> primer dumbed-down enough to explain what that means in lay terms.
>> I need to see what controls there are for the "MDX" algorithm's  
>> passwords length before I can determine the bit level.
>
> Doesn't enforcing password length get into the public key/private key  
> setup?

Not an issue with the "MDX" algorithm. It looks like you can have as  
long of a password as you want with this. That just adds to the  
strength the longer it is.

> Is there a way to provide stronger encryption with the simplicity of a  
> single password?

Yes. I just added CBC and 16 random initialization vectors to the "MDX"  
algorithm.

> Your description on cypher block chaining was excellent -- thank you.
>
> Thank you for the excellent post.  I learned more reading your  
> one-pager than in an hour of prowling the 'Net.
>
> --  
>  Richard Gaskin

Here is more from the beach and I'll send the example as an attachment  
on to you:

-- all in all, this "MDX" algorithm is very interesting.
-- encrypt
     local cbcVecText
     put md5digest(pPassword) into tKeyString
     put len(tKeyString) into tKeyStringLen
     --
     ---- new  for CBC ----
     -- adds 16 random chars to pad the front of pData
      
put"a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,1,2,3,4,5,6,7,8, 
9,0" into xBx
     put "" into zink
     repeat with i = 1 to 16
       put random(36) into dipc
       put item dipc of xBx after zink
     end repeat
     put zink & pData into pData
     ---- new  for CBC ----

     -- Apply it with Xor to the data one byte at a time:
     put 0 into i
     put empty into tCryptoText

     --- new ---
     put "a" into cbcVecText
     --- new ---
     repeat for each char k in pData
       add 1 to i
       if i > tKeyStringLen then put 1 into i
       put char i of tKeyString into tKeyChar

       --- new ---
       put  numtochar( chartonum(k) bitxor chartonum(tKeyChar)) into  
bCrypt
       put  numtochar( chartonum(cbcVecText) bitxor chartonum(bCrypt))  
after tCryptoText
       put bCrypt into cbcVecText
       --- new ---
     end repeat

-- decrypt
     local cbcVecText
     put md5digest(pPassword) into tKeyString
     put len(tKeyString) into tKeyStringLen
     --
     -- Apply it with Xor to the data one byte at a time:
     put 0 into i
     put empty into tClearText

     --- new ---
     put "a" into cbcVecText
     --- new ---
     repeat for each char k in pData
       add 1 to i
       if i > tKeyStringLen then put 1 into i
       put char i of tKeyString into tKeyChar

       --- new ---
       put  numtochar( chartonum(cbcVecText) bitxor chartonum(k)) into  
bCrypt
       put bCrypt into cbcVecText
       put  numtochar( chartonum(cbcVecText) bitxor chartonum(tKeyChar))  
after tClearText
       --- new ---
     end repeat
     put tClearText into pData
     --- new ---
     -- delete char 1 to 16 of pData at some point
     --- new ---

Hope you like this,
Mark



More information about the use-livecode mailing list