Re: New stream cipher algorithm, Adaptive Stream Cipher
From: John E. Hadstate (nospam_at_null.nil)
Date: 08/16/03
- Next message: Gregory G Rose: "Re: Kasumi cipher"
- Previous message: Rob Warnock: "Re: IANAL - Re: License questions"
- In reply to: Benjamin Choi: "New stream cipher algorithm, Adaptive Stream Cipher"
- Next in thread: Benjamin Choi: "Re: New stream cipher algorithm, Adaptive Stream Cipher"
- Reply: Benjamin Choi: "Re: New stream cipher algorithm, Adaptive Stream Cipher"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Sat, 16 Aug 2003 12:06:37 -0400
"Benjamin Choi" <contact@technosoft21.com> wrote in message
news:2ca0a833.0308152021.72efe665@posting.google.com...
> Hello,
>
> Lately I've created a simple encryption algorithm (inspired by RC4's
> design) which generates a seemingly random stream of bytes which is
> then combined with the message using bitwise XOR. It generates the key
> using the supplied passphrase as well as the message to be encrypted,
> giving it its name of Adaptive Stream Cipher. It achieves an avalanche
> effect. It uses two arrays: the SBox and the Key Array.
>
> Please help me cryptanalyse it for weakness. I am sure there would be
> quite a few.
===========================================================
Before we do that, we need to get the source code debugged!
I noticed a number of references to "Mod 255". Do you not
mean "Mod 256" in most of those cases?
===========================================================
>
> Visual Basic 6 source code implementation:
> ------------------------------------------------------------
>
> Option Explicit
> Dim SBox(255) As Long
> Dim KeyArr(255) As Long
>
> Sub ASCInitialise(Msg As String, Key As String, Encrypt As Boolean)
> Dim i As Long
> Dim Seed As Long
> 'Initialise arrays
>
>
> For i = 0 To 255
> KeyArr(i) = Asc(Mid(Key, (i Mod Len(Key)) + 1, 1))
> KeyArr(i) = (KeyArr(i) + Asc(Mid(Key, (i Mod (Len(Key) - 1)) +
> 2, 1))) Mod 255
> SBox(i) = KeyArr(i) Xor i
> Next
===========================================================
What happens when Len(Key) = 1? You compute
Mid(Key, (i mod 1) + 1, 1).
Then, in the next line, you compute
Mid(Key, (i Mod (0)) + 2, 1)!
What happens when you compute i Mod 0?
I'll have to take your word for it but I think you really mean this:
KeyArr(i) = (Asc(Mid(Key, ((i+2) Mod Len(Key)), 1)) +
Asc(Mid(Key, ((i) Mod Len(Key)), 1)) Mod 255)
I am unfamiliar with VB. Does the Mid(a, b, c) function want to see "b=0"
for first position of the string or does it want "b=1"?
===========================================================
> 'Replace SBox elements
> Seed = 0
>
>
> For i = 0 To 255
> Seed = ((Seed Xor SBox(i)) + KeyArr(i)) Mod 255
> SBox(i) = (SBox(i) + Seed) Mod 255
> Next
What kind of a random number generator is this? It looks a little like a
hash algorithm, but without the across-byte mixing that one would expect.
> End Sub
>
>
> Public Function ASCCrypt(Msg As String, Key As String, Encrypt As
> Boolean) As String
> Dim i As Long
> Dim ASCMsg As String
> Dim ASCString As String
> ASCMsg = Msg
> ASCInitialise ASCMsg, Key, Encrypt
>
>
> For i = 1 To Len(ASCMsg)
> ASCString = ASCString & Chr(ASCPureCrypt(Asc(Mid(ASCMsg, i,
> 1)), Encrypt, i))
> Next
> ASCCrypt = ASCString
> End Function
>
>
> Public Function ASCPureCrypt(Msg As Byte, Encrypt As Boolean, BytePos
> As Long) As Byte
> Dim k As Long
> Dim lngCipher As Long
> 'Adapt SBox
>
>
> If Encrypt = True Then
> SBox((BytePos + 1) Mod 255) = (SBox((BytePos + 1) Mod 255) +
> Msg) Mod 255
> End If
> k = SBox(BytePos Mod 255)
> k = k Xor KeyArr(BytePos Mod 255)
> 'Combine message with keystream
> lngCipher = Msg Xor k
> 'Adapt SBox
>
>
> If Encrypt = False Then
> SBox((BytePos + 1) Mod 255) = (SBox((BytePos + 1) Mod 255) +
> lngCipher) Mod 255
> End If
> ASCPureCrypt = lngCipher
> End Function
>
> ------------------------------
> Benjamin Choi
> contact at technosoft21 dot com
- Next message: Gregory G Rose: "Re: Kasumi cipher"
- Previous message: Rob Warnock: "Re: IANAL - Re: License questions"
- In reply to: Benjamin Choi: "New stream cipher algorithm, Adaptive Stream Cipher"
- Next in thread: Benjamin Choi: "Re: New stream cipher algorithm, Adaptive Stream Cipher"
- Reply: Benjamin Choi: "Re: New stream cipher algorithm, Adaptive Stream Cipher"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|