On Sun, 19 Oct 2008 16:38:37 +1300, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Steven D'Aprano
wrote:
On Sat, 18 Oct 2008 09:16:11 +1300, Lawrence D'Oliveiro wrote:
Data can come in fractional bits. That's how compression works.
If you don't believe me, try compressing a
On Sun, 19 Oct 2008 04:38:04 +, Tim Roberts wrote:
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
Is piece really meant to be random? If so, your create_random_block
function isn't achieving much--xoring random data together isn't
On Oct 19, 7:13 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote:
On Sun, 19 Oct 2008 04:38:04 GMT, Tim Roberts [EMAIL PROTECTED] declaimed
the following in comp.lang.python:
For those who got a bit lost here, I'd would point out that Knuth[1] has an
excellent chapter on random numbers that
Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Steven D'Aprano
wrote:
On Sat, 18 Oct 2008 09:16:11 +1300, Lawrence D'Oliveiro wrote:
Data can come in fractional bits. That's how compression works.
If you don't believe me, try compressing a single bit and see if you get
a
Steven D'Aprano wrote:
On Sun, 19 Oct 2008 04:38:04 +, Tim Roberts wrote:
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
Is piece really meant to be random? If so, your create_random_block
function isn't achieving much--xoring
In message [EMAIL PROTECTED], Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Steven D'Aprano
wrote:
On Sat, 18 Oct 2008 09:16:11 +1300, Lawrence D'Oliveiro wrote:
Data can come in fractional bits. That's how compression works.
If you don't believe me, try compressing a single
On Fri, 17 Oct 2008 13:59:27 +0100, Sion Arrowsmith wrote:
[I think these attributions are right] Steven D'Aprano
[EMAIL PROTECTED] wrote:
On Fri, 17 Oct 2008 22:45:19 +1300, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Steven
D'Aprano wrote:
... why do you say that xoring
On Sat, 18 Oct 2008 09:16:11 +1300, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Sion Arrowsmith
wrote:
Maybe it should be fewer random data.
Except these days we tend to think of data being, say, more like
flour than bees, so it's less data, like less flour, rather than
In message [EMAIL PROTECTED], Steven D'Aprano
wrote:
On Sat, 18 Oct 2008 09:16:11 +1300, Lawrence D'Oliveiro wrote:
Data can come in fractional bits. That's how compression works.
If you don't believe me, try compressing a single bit and see if you get
a fractional bit.
If both states of
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
Is piece really meant to be random? If so, your create_random_block
function isn't achieving much--xoring random data together isn't going
to produce anything more exciting than less random
In message [EMAIL PROTECTED], Michele wrote:
class Encoder(object):
def create_random_block(self, data, seed, blocksize):
number_of_blocks = int(len(data)/blocksize)
random.seed(seed)
random_block = ['0'] * blocksize
for index in range(number_of_blocks):
On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
Is piece really meant to be random? If so, your create_random_block
function isn't achieving much--xoring random data together isn't going
to produce anything more exciting than less random data than you started
with.
Hmmm...
Michele [EMAIL PROTECTED] writes:
I suppose that ord() and char() are the main problems
yes
How should I decrease the execution time?
See http://nightsong.com/phr/crypto/p3.py which deals with
the same problem by using the array module to do the xor's
32 bits at a time.
--
On Fri, 17 Oct 2008 22:45:19 +1300, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Steven D'Aprano
wrote:
On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
... why do you say that xoring random data with other random data
produces less randomness than you started
In message [EMAIL PROTECTED], Steven D'Aprano
wrote:
On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote:
... why do you say that xoring random data with other random data
produces less randomness than you started with?
blocksize = number_of_blocks * blocksize
--
[I think these attributions are right]
Steven D'Aprano [EMAIL PROTECTED] wrote:
On Fri, 17 Oct 2008 22:45:19 +1300, Lawrence D'Oliveiro wrote:
In message [EMAIL PROTECTED], Steven D'Aprano
wrote:
... why do you say that xoring random data with other random data
produces less randomness than
In message [EMAIL PROTECTED], Sion Arrowsmith wrote:
Maybe it should be fewer random data.
Except these days we tend to think of data being, say, more like flour
than bees, so it's less data, like less flour, rather than
like fewer bees. :)
After all, each byte in the block is discrete.
Data
On Oct 15, 10:19 pm, Michele [EMAIL PROTECTED] wrote:
Hi,
I'm trying to encode a byte data. Let's not focus on the process of
encoding; in fact, I want to emphasize that the method
create_random_block takes 0.5s to be executed (even Java it's faster) on
a Dual-Core 3.0Ghz machine:
took
Hi,
I'm trying to encode a byte data. Let's not focus on the process of
encoding; in fact, I want to emphasize that the method
create_random_block takes 0.5s to be executed (even Java it's faster) on
a Dual-Core 3.0Ghz machine:
took 46.74679s, avg: 0.4674679s
Thus I suppose that the xor
My answer is: never do things like this with python.
You will find this module useful: www.pycrypto.org
On Oct 15, 12:19 pm, Michele [EMAIL PROTECTED] wrote:
Hi,
I'm trying to encode a byte data. Let's not focus on the process of
encoding; in fact, I want to emphasize that the method
Few suggestions for your code:
- Use xrange instead of range.
- Loop over lists where you can instead of their indexes.
- array.array(B, somestring) may help you because it gives a byte
view of a string.
- Using psyco helps a lot for such kind of code.
- I think numpy arrays can contain text/chars
Michele wrote:
I'm trying to encode a byte data. Let's not focus on the process of
encoding; in fact, I want to emphasize that the method
create_random_block takes 0.5s to be executed (even Java it's faster) on
a Dual-Core 3.0Ghz machine:
took 46.74679s, avg: 0.4674679s
How
22 matches
Mail list logo