[28507] in Perl-Users-Digest
Perl-Users Digest, Issue: 9871 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Oct 20 14:05:53 2006
Date: Fri, 20 Oct 2006 11:05:07 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 20 Oct 2006 Volume: 10 Number: 9871
Today's topics:
Re: Efficient Searching jgraber@ti.com
Re: FTP to a windows file share? <mattjones@hotmail.co.uk>
Re: FTP to a windows file share? <scobloke2@infotop.co.uk>
Re: FTP to a windows file share? <mattjones@hotmail.co.uk>
Re: FTP to a windows file share? <mattjones@hotmail.co.uk>
Re: FTP to a windows file share? <glex_no-spam@qwest-spam-no.invalid>
Re: FTP to a windows file share? <bwilkins@gmail.com>
Re: FTP to a windows file share? <bart.lateur@pandora.be>
Re: FTP to a windows file share? <bart.lateur@pandora.be>
How can i find source code like Data::Dumper in perl pa jagon.cn@gmail.com
Re: How can i find source code like Data::Dumper in per <mritty@gmail.com>
Re: How can i find source code like Data::Dumper in per <David.Squire@no.spam.from.here.au>
Re: How can i find source code like Data::Dumper in per <and@vmn.dk>
Re: How can i find source code like Data::Dumper in per <davidjpeacock@magma.ca>
Re: How can i find source code like Data::Dumper in per <David.Squire@no.spam.from.here.au>
Re: How can i find source code like Data::Dumper in per <bik.mido@tiscalinet.it>
Re: How can i find source code like Data::Dumper in per <bik.mido@tiscalinet.it>
New lightweight block cipher algorithm <jcesar@inf.uc3m.es>
Re: New lightweight block cipher algorithm <ajonospam@andrew.cmu.edu>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 20 Oct 2006 10:45:01 -0500
From: jgraber@ti.com
Subject: Re: Efficient Searching
Message-Id: <yvn64eft2iq.fsf@famous02.dal.design.ti.com>
HaroldWho <hlarons@yahoo.com> writes:
> On Wed, 18 Oct 2006 18:40:11 -0000, HaroldWho wrote in comp.lang.perl.misc:
> > I have an 2.7 Mb, 75,000 line comma-separated ASCII file with each line
> > of the form: integer_1,integer_2,string_1,string_2
> >
> > Given a target integer, I need to search for the record for which
> > target >= integer_1 && target <= integer_2.
>
> To answer some of the many questions posed by all the replies:
>
> 1. Ranges do not overlap.
>
> 2. The point of the search is to get the strings. I thought that would be
> clear, but evidently it wasn't.
>
> 3. I have used a linear search, going line-by-line through the array to find
> the line where target >= integer_1 && target <= integer_2.
>
> BTW, reading the file into memory is very fast. I tried just reading
> line-by-line, but the results aren't noticeably different.
>
> There seems to be two ideas here for me to followup on:
>
> a) A binary search (full disclosure: I'm not a CS person, so I'll need to learn
> more about this).
>
> b) The suggestion by Mirco Wahab. Particular thanks to you for trying to read
> my mind.
>
> Work continues; many thanks to all.
>
> HW
What about the all the other questions?
What is your goal? 20ms? 2 Seconds?
If the total range is 'small', you still use a direct lookup array.
Since the ranges do not overlap, then there cannot be multiple hits.
If the ranges have gaps, then there can be misses.
A binary search is like playing Higher or Lower when
guessing a number between 1 and 100, 80 for example
50? higher
75? higher
87? lower
...
Binary search will find the answer in worst case
log2(75000) = about 17 comparisons,
or about 37000 fewer comparisons than an average linear search.
--
Joel
------------------------------
Date: 20 Oct 2006 06:16:16 -0700
From: "MattJ83" <mattjones@hotmail.co.uk>
Subject: Re: FTP to a windows file share?
Message-Id: <1161350176.149507.212840@e3g2000cwe.googlegroups.com>
> Somebody correct me if I am wrong, but can't he just execute a
> exec("copy ...") within Perl? Would Perl even be useful for this task?
> Why not a batch script?
Ahh - the answer to that is that the script is already in place - i
just have to add code to the current script! So while it might not be
the most efficient way - its the way that i have to do it :-(
The script basically uses Net::FTP and File::Copy. It copies a set of
files from a location on the server to another - it then connects to a
unix server and ftp's the info across. It transfers the same data to
another unix server which it connects to. It then unlinks the files
from the source. If the data has not been ftp'ed the data is not
deleted.
So, the script is there - i just thought i could set the script to
connect to a windows server after the unix servers so that the script
could just do an extra task. The fact that i can't log into the windows
server and have to treat it like a file share has just complicated it
for me.
------------------------------
Date: Fri, 20 Oct 2006 14:29:36 +0100
From: Ian Wilson <scobloke2@infotop.co.uk>
Subject: Re: FTP to a windows file share?
Message-Id: <PLKdnZdMpZHYUqXYnZ2dnUVZ8tGdnZ2d@bt.com>
MattJ83 wrote:
> hmm......
> So if i just open the file (as above) -
It would help if you quoted what you are referring to (as I am).
> i can then transfer information
> into it as normal?
Yes.
> I was under the impression i was going to have to use something like
> Win32::NetResource
No,
C:\temp>type \\Violet\Infotop\UNC.txt
This is a text file on another PC
C:\temp>type test.pl
#!perl
use strict;
use warnings;
open my $fh, '<', '//Violet/Infotop/UNC.txt'
or die "Unable to open file because $!";
while (<$fh>) { print; }
close $fh;
C:\temp>test.pl
This is a text file on another PC
> (im sorry - i don't think i said it was a windows server!).
I assumed it was since the UNC notation you used is mostly associated
with Windows.
> The script currently transfers to unix servers by using &transfer
> ('server', 'username', 'password').
I've no idea what is in your "transfer" subroutine. Does it matter?
> I need to connect to a windows server but the server won't let me log
> on normally (policy of the server to not allow interactive login). So i
> have to connect directly to the network resource (as you would map to a
> drive). And then just allow the script to copy the information over to
> the new loacation as well.
>
See above.
------------------------------
Date: 20 Oct 2006 08:02:54 -0700
From: "MattJ83" <mattjones@hotmail.co.uk>
Subject: Re: FTP to a windows file share?
Message-Id: <1161356574.920862.76870@m73g2000cwd.googlegroups.com>
> C:\temp>type \\Violet\Infotop\UNC.txt
> This is a text file on another PC
>
^^^ are you just creating a txt file here in temp? but with
'\\Violet\Infotop\UNC.txt' as a filename?
>
> C:\temp>type test.pl
> #!perl
> use strict;
> use warnings;
> open my $fh, '<', '//Violet/Infotop/UNC.txt'
> or die "Unable to open file because $!";
> while (<$fh>) { print; }
> close $fh;
>
>
> C:\temp>test.pl
> This is a text file on another PC
This code is just creating a file called UNC.txt in temp and then
running some code from temp to open the file isn't it?
Im trying to run the script from a unix server (bash shell) and trying
to get the same result at the moment (ie - open a file from a windows
file share in unix).
Eventually - getting the data passed from unix to this windows file
share.
------------------------------
Date: 20 Oct 2006 08:02:58 -0700
From: "MattJ83" <mattjones@hotmail.co.uk>
Subject: Re: FTP to a windows file share?
Message-Id: <1161356578.817451.134530@b28g2000cwb.googlegroups.com>
> C:\temp>type \\Violet\Infotop\UNC.txt
> This is a text file on another PC
>
^^^ are you just creating a txt file here in temp? but with
'\\Violet\Infotop\UNC.txt' as a filename?
>
> C:\temp>type test.pl
> #!perl
> use strict;
> use warnings;
> open my $fh, '<', '//Violet/Infotop/UNC.txt'
> or die "Unable to open file because $!";
> while (<$fh>) { print; }
> close $fh;
>
>
> C:\temp>test.pl
> This is a text file on another PC
This code is just creating a file called UNC.txt in temp and then
running some code from temp to open the file isn't it?
Im trying to run the script from a unix server (bash shell) and trying
to get the same result at the moment (ie - open a file from a windows
file share in unix).
Eventually - getting the data passed from unix to this windows file
share.
------------------------------
Date: Fri, 20 Oct 2006 10:18:10 -0500
From: "J. Gleixner" <glex_no-spam@qwest-spam-no.invalid>
Subject: Re: FTP to a windows file share?
Message-Id: <4538e86a$0$598$815e3792@news.qwest.net>
MattJ83 wrote:
No idea what this has to do with FTP....
>> C:\temp>type test.pl
>> #!perl
>> use strict;
>> use warnings;
>> open my $fh, '<', '//Violet/Infotop/UNC.txt'
>> or die "Unable to open file because $!";
>> while (<$fh>) { print; }
>> close $fh;
>>
>>
>> C:\temp>test.pl
>> This is a text file on another PC
>
> This code is just creating a file called UNC.txt in temp and then
> running some code from temp to open the file isn't it?
No. In general, it's opening the file //Violet/Infotop/UNC.txt, for a
read ( '<' ), reading each line into $_, and printing $_ to STDOUT. It's
not creating a file nor is it doing anything with 'temp'.
If you want to create a file and write something to it:
open( my $output, '>', '/some/file' )
or die "Can't write /some/file: $!";
print $output "blah\n";
close( $output );
perldoc perlopentut
Or you could redirect the output of your script to a file:
test.pl > /some/file
------------------------------
Date: 20 Oct 2006 08:17:58 -0700
From: "Brian Wilkins" <bwilkins@gmail.com>
Subject: Re: FTP to a windows file share?
Message-Id: <1161357478.913247.282030@i42g2000cwa.googlegroups.com>
MattJ83 wrote:
> > C:\temp>type \\Violet\Infotop\UNC.txt
> > This is a text file on another PC
> >
>
> ^^^ are you just creating a txt file here in temp? but with
> '\\Violet\Infotop\UNC.txt' as a filename?
>
> >
> > C:\temp>type test.pl
> > #!perl
> > use strict;
> > use warnings;
> > open my $fh, '<', '//Violet/Infotop/UNC.txt'
> > or die "Unable to open file because $!";
> > while (<$fh>) { print; }
> > close $fh;
> >
> >
> > C:\temp>test.pl
> > This is a text file on another PC
>
> This code is just creating a file called UNC.txt in temp and then
> running some code from temp to open the file isn't it?
>
> Im trying to run the script from a unix server (bash shell) and trying
> to get the same result at the moment (ie - open a file from a windows
> file share in unix).
> Eventually - getting the data passed from unix to this windows file
> share.
I think you need to use Samba if you are going to connect to a Windows
Share on a Linux machine.
------------------------------
Date: Fri, 20 Oct 2006 17:58:05 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: FTP to a windows file share?
Message-Id: <dg3ij2temijua4n6gi6hc6nnis7gjcfluh@4ax.com>
MattJ83 wrote:
>The trouble is i don't think the file share format '\\ukbr1234\share'
>is accepted by the perl script.....
It is. But if you use it like this, double the backslashes. Or, use
forward slashes.
And you can access them like plain files.
--
Bart.
------------------------------
Date: Fri, 20 Oct 2006 17:58:40 GMT
From: Bart Lateur <bart.lateur@pandora.be>
Subject: Re: FTP to a windows file share?
Message-Id: <9i3ij2l3m7cnr2tnkj05vbst7p44ive4d8@4ax.com>
Ian Wilson wrote:
>In that double-quoted string constant, \s means any whitespace character
>doesn't it?
>
>I'd use single quotes: '\\ukbr1234\share\test'
That doesn't solve this problem.
--
Bart.
------------------------------
Date: 20 Oct 2006 07:21:21 -0700
From: jagon.cn@gmail.com
Subject: How can i find source code like Data::Dumper in perl package
Message-Id: <1161354081.665592.208630@m7g2000cwm.googlegroups.com>
i am running on linux box and i am trying to find the module source
code of Data::Dumper from my perl lib /usr/lib/perl5, but i can not get
it.
Is there anyone who can tell me how to find it on my machine or
actually it does not exist. I also can not find Net::SSLeay.
my linux box is CentOS 4
Thanks
Jay
------------------------------
Date: 20 Oct 2006 07:23:03 -0700
From: "Paul Lalli" <mritty@gmail.com>
Subject: Re: How can i find source code like Data::Dumper in perl package
Message-Id: <1161354183.672034.215170@m7g2000cwm.googlegroups.com>
jagon...@gmail.com wrote:
> i am running on linux box and i am trying to find the module source
> code of Data::Dumper from my perl lib /usr/lib/perl5, but i can not get
> it.
>
> Is there anyone who can tell me how to find it on my machine or
> actually it does not exist. I also can not find Net::SSLeay.
perl -MData::Dumper -le'print $INC{q{Data/Dumper.pm}}'
Paul Lalli
------------------------------
Date: Fri, 20 Oct 2006 15:25:41 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: How can i find source code like Data::Dumper in perl package
Message-Id: <eham95$ri1$1@gemini.csx.cam.ac.uk>
Paul Lalli wrote:
> perl -MData::Dumper -le'print $INC{q{Data/Dumper.pm}}'
Just out of interest, what does the '-l' switch do above?
DS
------------------------------
Date: Fri, 20 Oct 2006 17:06:29 +0200
From: Anders Ossowicki <and@vmn.dk>
Subject: Re: How can i find source code like Data::Dumper in perl package
Message-Id: <newscache$xmwf7j$ct4$1@news.webpartner.dk>
David Squire wrote:
> perl -MData::Dumper -le'print $INC{q{Data/Dumper.pm}}'
-l[octal] enable line ending processing, specifies line terminator
In this case, it make perl send a line terminator at the end of the output:
$ perl -MData::Dumper -le'print $INC{q{Data/Dumper.pm}}'
/usr/lib/perl5/5.8.8/i686-linux/Data/Dumper.pm
$ perl -MData::Dumper -e'print $INC{q{Data/Dumper.pm}}'
/usr/lib/perl5/5.8.8/i686-linux/Data/Dumper.pm$
--
//anders
------------------------------
Date: Fri, 20 Oct 2006 10:40:37 -0500
From: David Peacock <davidjpeacock@magma.ca>
Subject: Re: How can i find source code like Data::Dumper in perl package
Message-Id: <slrnejhrfl.27t.davidjpeacock@david-peacocks-computer.local>
jagon.cn@gmail.com <jagon.cn@gmail.com> wrote:
> i am running on linux box and i am trying to find the module source
> code of Data::Dumper from my perl lib /usr/lib/perl5, but i can not get
> it.
>
> Is there anyone who can tell me how to find it on my machine or
> actually it does not exist. I also can not find Net::SSLeay.
perldoc -l Data::Dumper
--
David Peacock - davidjpeacock@magma.ca
http://quasicanuck.blogspot.com/
------------------------------
Date: Fri, 20 Oct 2006 17:19:59 +0100
From: David Squire <David.Squire@no.spam.from.here.au>
Subject: Re: How can i find source code like Data::Dumper in perl package
Message-Id: <ehasvf$bqu$1@gemini.csx.cam.ac.uk>
Anders Ossowicki wrote:
> David Squire wrote:
>
>> perl -MData::Dumper -le'print $INC{q{Data/Dumper.pm}}'
> -l[octal] enable line ending processing, specifies line terminator
> In this case, it make perl send a line terminator at the end of the output:
> $ perl -MData::Dumper -le'print $INC{q{Data/Dumper.pm}}'
> /usr/lib/perl5/5.8.8/i686-linux/Data/Dumper.pm
> $ perl -MData::Dumper -e'print $INC{q{Data/Dumper.pm}}'
> /usr/lib/perl5/5.8.8/i686-linux/Data/Dumper.pm$
Thanks. The value of my prompt variable was masking that effect for me
(it starts with \n\n, and I didn't notice the smaller gap).
DS
------------------------------
Date: 20 Oct 2006 18:51:46 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How can i find source code like Data::Dumper in perl package
Message-Id: <nivhj2p921f90b1abvaa35g6a63mipt8kl@4ax.com>
On Fri, 20 Oct 2006 15:25:41 +0100, David Squire
<David.Squire@no.spam.from.here.au> wrote:
>Paul Lalli wrote:
>
>> perl -MData::Dumper -le'print $INC{q{Data/Dumper.pm}}'
>
>Just out of interest, what does the '-l' switch do above?
perldoc perlrun
(it print()s "\n".)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 20 Oct 2006 18:54:20 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: How can i find source code like Data::Dumper in perl package
Message-Id: <1kvhj2d7j9ihoc6iejmep76tf3o5vbcq6r@4ax.com>
On 20 Oct 2006 07:21:21 -0700, jagon.cn@gmail.com wrote:
>i am running on linux box and i am trying to find the module source
>code of Data::Dumper from my perl lib /usr/lib/perl5, but i can not get
>it.
Not that there's much to say, but also see:
http://perlmonks.org/?node_id=579097
(the comments, *not* the root node.)
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 20 Oct 2006 06:49:35 -0700
From: "Julio C. Hernandez Castro" <jcesar@inf.uc3m.es>
Subject: New lightweight block cipher algorithm
Message-Id: <1161352175.817923.35400@f16g2000cwb.googlegroups.com>
Dear all,
We have just developped a new block cipher called Raiden, following a
Feistel Network structure by means of genetic programming. Our
intention now consists on getting as much feedback as possible from
users, so we encourage you to test the algorithm and send us your
opinion. We would also like to receive enhancements and new versions of
the algorithm, developed in other source languages and platforms.
Our idea on developing this cipher is to propose it as an alternative
to TEA block cipher. TEA is a very interesting cipher with lots of real
applications. It is very simple and fast, and it reaches an acceptable
level of security by the application of a lot of cycles.
Nowadays TEA has been broken, and several weaknesses of the algorithm
have been discovered. Since most of these weaknesses are related to its
Key Shedule routine, the authors, Roger Needham and David Wheeler
proposed an extended version of the algorithm with a more complex one.
This new version, which they called XTEA, did not have the expected
success of its antecessor, in part because it is slower.
The algorithm known weaknesses, as well as its popularity, have made us
to think it was the time to develop an alternative to TEA. This
alternative, presented in this page, must have the next features:
* It must be as quick as TEA, to be used in the same real world
applications
* It must be stronger, to avoid TEA weaknesses
To develop this new block cipher we have used a genetic
programming-based technique. More on this to follow in a coming
scientific paper.
Description of Raiden
----------------------------
Raiden is a very small and compact cipher. It works with blocks of 64
bits and keys of 128. As it can be seen below, the algorithm has the
same main structure as TEA: it is structured in cycles, where one cycle
contains two feistel rounds, and for both of them, the same round key
is used. In each round, the output of the round function on a sub block
is used to feed the other one. The round function of the algorithm has
the same size as TEA's one, but, as commented in section Raiden
Strength, it seems to be stronger.
The Key Schedule routine is more complex than TEA's, but it is simple
enough to not overload the cipher execution time. To maximize the
entropy introduced by this function, in each round, its output feeds
the position i%4 of the key array. This makes the key array passed to
the function to evolve as the algorithm is executed, and thus
generating new round keys for each cycle with that 128 bit array. This
also makes that function to behave much as a PRNG. After analyzing the
algorithm, as commented in it homepage
(http://raiden-cipher.sourceforge.net/ in the Results section), we
propose the execution of sixteen cycles. Below, the code of Raiden
encoding routine is shown.
void raiden(unsigned long *data,unsigned long *result,unsigned long
*key)
{
unsigned long b0=data[0],
b1=data[1],i,k[4]={key[0],key[1],key[2],key[3]}, sk;
for(i=0; i< 16; i++)
{
sk=k[i%4]=((k[0]+k[1])+((k[2]+k[3])^(k[0]<<k[2])));
b0 +=((sk+b1)<<9)^((sk-b1)^((sk+b1)>>14));
b1 +=((sk+b0)<<9)^((sk-b0)^((sk+b0)>>14));
}
result[0]=b0;
result[1]=b1;
}
The cipher receives the plain text in 'data' parameter, and puts the
cipher text in the 'result'. Key contains the 128 bit cipher key.
The cipher follows a Feistel structure, so the decoding is made in the
same way than the encoding but applying the round keys in the inverse
order. This is the Raiden decoding routine.
void decode_raiden(unsigned long *data,unsigned long *result,unsigned
long *key)
{
unsigned long b0=data[0],
b1=data[1],i,k[4]={key[0],key[1],key[2],key[3]},
subkeys[16];
for(i=0;i< 16;i++){
//Subkeys are calculated
k[i%4]=((k[0]+k[1])+((k[2]+k[3])^(k[0]<<k[2])));
subkeys[i]=k[i%4];
}
for(i=15; i!=-1; i--)
{
//Process is applied in the inverse order
b1 -= ((subkeys[i]+b0)<<9)^((subkeys[i]-b0)^
((subkeys[i]+b0)>>14));
b0 -= ((subkeys[i]+b1)<<9)^((subkeys[i]-b1)^
((subkeys[i]+b1)>>14));
}
result[0]=b0;
result[1]=b1;
}
In this case, the function receives the ciphertext in the 'data'
parameter and puts the plain text in the 'result'. The round keys are
calculated at the beginning of the function, and then they are applied
in the inverse order as they were when ciphering.
The algorithm is free to anyone, and has been developed in ANSI C
source code under Linux.
We propose you to develop new versions of it using other programming
languages and platforms.
Raiden Strength
---------------------
The main weaknesses of TEA, such as the Related Key Cryptanalysis, or
the equivalent keys, are related with its Key Shedule routine. Thus,
one of the main objectives when developing this new cipher has been to
develop an stronger Key Shedule function than TEA's.
The function developed is also very simple, but not as much as TEA's.
TEA Key Shedule function consists only on adding a constant
(0x9e3779b9) to a variable. Thus, it is very simple to, knowing the
round key of cycle i, obtain the keys corresponding to the previous and
the following cycles. This is not the case in our algorithm, in which
doing so it is not a trivial problem.
Therefore, the Key Shedule function behaves more as a Hash Function or
pseudorandom number generator, and does not have the same weaknesses as
TEA Key Schedule. Raiden's Round Function provided much better results
in the statistical tests than TEA's one, so we can conclude it is also
stronger, and, therefore, that the whole algorithm is also stronger.
When we analyzed the algorithm using the statistical tests ENT,
Diehard, NIST and Sexton, we realized that Raiden results when applied
16 cycles were, in many ocassions better, and at least comparable, to
TEA results when applied 32. This made us to conclude Raiden is
stronger than TEA and that 16 cycles would be an enough security margin
for the algorithm to be applied. The mentioned results can be consulted
in the Results of statistical tests on Raiden section at
http://raiden-cipher.sourceforge.net/
About the Authors
------------------------
Raiden has been developed by:
Julio Cesar Hernandez Castro, e-mail: jcesar_at_inf_dot_uc3m_dot_es
Javier Polimon Olabarrieta, jpolimon_at_gmail_dot_com
Don't hesitate to contact the authors with your feedback.
------------------------------
Date: Fri, 20 Oct 2006 12:53:52 -0400 (EDT)
From: "Arthur J. O'Dwyer" <ajonospam@andrew.cmu.edu>
Subject: Re: New lightweight block cipher algorithm
Message-Id: <Pine.LNX.4.61-042.0610201253470.30865@unix35.andrew.cmu.edu>
On Fri, 20 Oct 2006, Julio C. Hernandez Castro wrote:
>
> Dear all,
No kidding!
> We have just developped a new block cipher called Raiden, following a
> Feistel Network structure by means of genetic programming. Our
> intention now consists on getting as much feedback as possible from
> users, so we encourage you to test the algorithm and send us your
> opinion. We would also like to receive enhancements and new versions of
> the algorithm, developed in other source languages and platforms.
Is there a reason you crossposted this announcement to everywhere
on Usenet /except/ sci.crypt? Followups set.
(The rest of the post follows, untrimmed, for the benefit of sci.crypt
readers.)
-Arthur
> Our idea on developing this cipher is to propose it as an alternative
> to TEA block cipher. TEA is a very interesting cipher with lots of real
> applications. It is very simple and fast, and it reaches an acceptable
> level of security by the application of a lot of cycles.
>
> Nowadays TEA has been broken, and several weaknesses of the algorithm
> have been discovered. Since most of these weaknesses are related to its
> Key Shedule routine, the authors, Roger Needham and David Wheeler
> proposed an extended version of the algorithm with a more complex one.
> This new version, which they called XTEA, did not have the expected
> success of its antecessor, in part because it is slower.
>
> The algorithm known weaknesses, as well as its popularity, have made us
> to think it was the time to develop an alternative to TEA. This
> alternative, presented in this page, must have the next features:
>
> * It must be as quick as TEA, to be used in the same real world
> applications
> * It must be stronger, to avoid TEA weaknesses
>
> To develop this new block cipher we have used a genetic
> programming-based technique. More on this to follow in a coming
> scientific paper.
>
> Description of Raiden
> ----------------------------
>
> Raiden is a very small and compact cipher. It works with blocks of 64
> bits and keys of 128. As it can be seen below, the algorithm has the
> same main structure as TEA: it is structured in cycles, where one cycle
> contains two feistel rounds, and for both of them, the same round key
> is used. In each round, the output of the round function on a sub block
> is used to feed the other one. The round function of the algorithm has
> the same size as TEA's one, but, as commented in section Raiden
> Strength, it seems to be stronger.
>
> The Key Schedule routine is more complex than TEA's, but it is simple
> enough to not overload the cipher execution time. To maximize the
> entropy introduced by this function, in each round, its output feeds
> the position i%4 of the key array. This makes the key array passed to
> the function to evolve as the algorithm is executed, and thus
> generating new round keys for each cycle with that 128 bit array. This
> also makes that function to behave much as a PRNG. After analyzing the
> algorithm, as commented in it homepage
> (http://raiden-cipher.sourceforge.net/ in the Results section), we
> propose the execution of sixteen cycles. Below, the code of Raiden
> encoding routine is shown.
>
>
> void raiden(unsigned long *data,unsigned long *result,unsigned long
> *key)
> {
>
> unsigned long b0=data[0],
> b1=data[1],i,k[4]={key[0],key[1],key[2],key[3]}, sk;
> for(i=0; i< 16; i++)
> {
> sk=k[i%4]=((k[0]+k[1])+((k[2]+k[3])^(k[0]<<k[2])));
> b0 +=((sk+b1)<<9)^((sk-b1)^((sk+b1)>>14));
> b1 +=((sk+b0)<<9)^((sk-b0)^((sk+b0)>>14));
> }
> result[0]=b0;
> result[1]=b1;
> }
>
> The cipher receives the plain text in 'data' parameter, and puts the
> cipher text in the 'result'. Key contains the 128 bit cipher key.
> The cipher follows a Feistel structure, so the decoding is made in the
> same way than the encoding but applying the round keys in the inverse
> order. This is the Raiden decoding routine.
>
> void decode_raiden(unsigned long *data,unsigned long *result,unsigned
> long *key)
> {
>
> unsigned long b0=data[0],
> b1=data[1],i,k[4]={key[0],key[1],key[2],key[3]},
> subkeys[16];
> for(i=0;i< 16;i++){
> //Subkeys are calculated
> k[i%4]=((k[0]+k[1])+((k[2]+k[3])^(k[0]<<k[2])));
> subkeys[i]=k[i%4];
> }
> for(i=15; i!=-1; i--)
> {
> //Process is applied in the inverse order
> b1 -= ((subkeys[i]+b0)<<9)^((subkeys[i]-b0)^
> ((subkeys[i]+b0)>>14));
> b0 -= ((subkeys[i]+b1)<<9)^((subkeys[i]-b1)^
> ((subkeys[i]+b1)>>14));
> }
> result[0]=b0;
> result[1]=b1;
> }
>
> In this case, the function receives the ciphertext in the 'data'
> parameter and puts the plain text in the 'result'. The round keys are
> calculated at the beginning of the function, and then they are applied
> in the inverse order as they were when ciphering.
>
> The algorithm is free to anyone, and has been developed in ANSI C
> source code under Linux.
> We propose you to develop new versions of it using other programming
> languages and platforms.
>
> Raiden Strength
> ---------------------
>
> The main weaknesses of TEA, such as the Related Key Cryptanalysis, or
> the equivalent keys, are related with its Key Shedule routine. Thus,
> one of the main objectives when developing this new cipher has been to
> develop an stronger Key Shedule function than TEA's.
>
> The function developed is also very simple, but not as much as TEA's.
> TEA Key Shedule function consists only on adding a constant
> (0x9e3779b9) to a variable. Thus, it is very simple to, knowing the
> round key of cycle i, obtain the keys corresponding to the previous and
> the following cycles. This is not the case in our algorithm, in which
> doing so it is not a trivial problem.
>
> Therefore, the Key Shedule function behaves more as a Hash Function or
> pseudorandom number generator, and does not have the same weaknesses as
> TEA Key Schedule. Raiden's Round Function provided much better results
> in the statistical tests than TEA's one, so we can conclude it is also
> stronger, and, therefore, that the whole algorithm is also stronger.
>
> When we analyzed the algorithm using the statistical tests ENT,
> Diehard, NIST and Sexton, we realized that Raiden results when applied
> 16 cycles were, in many ocassions better, and at least comparable, to
> TEA results when applied 32. This made us to conclude Raiden is
> stronger than TEA and that 16 cycles would be an enough security margin
> for the algorithm to be applied. The mentioned results can be consulted
> in the Results of statistical tests on Raiden section at
> http://raiden-cipher.sourceforge.net/
>
> About the Authors
> ------------------------
>
> Raiden has been developed by:
>
> Julio Cesar Hernandez Castro, e-mail: jcesar_at_inf_dot_uc3m_dot_es
> Javier Polimon Olabarrieta, jpolimon_at_gmail_dot_com
>
> Don't hesitate to contact the authors with your feedback.
>
>
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>
Administrivia:
#The Perl-Users Digest is a retransmission of the USENET newsgroup
#comp.lang.perl.misc. For subscription or unsubscription requests, send
#the single line:
#
# subscribe perl-users
#or:
# unsubscribe perl-users
#
#to almanac@ruby.oce.orst.edu.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
#To request back copies (available for a week or so), send your request
#to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
#where x is the volume number and y is the issue number.
#For other requests pertaining to the digest, send mail to
#perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
#sending perl questions to the -request address, I don't have time to
#answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 9871
***************************************