Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
I have discoved that the mod function isn't quite right in dealing with powers, but, I'll have it fixed shortly. -- http://mail.python.org/mailman/listinfo/python-list

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
Well, the RSA element's never going to encrypt more than a small, 1 block system except under rare occasions, the primary encryption will be AES128. Thanks for the help though! -- http://mail.python.org/mailman/listinfo/python-list

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
Okay, the bug in my code has been fixed, it should work alot better now... I thought I had tested the power function, but I appearently wasn't even close... But now it works just fine. I guess you are right, I will have to work on a better system to be cryptologically secure. But, at least I have

Re: Random Prime Generator/Modular Arithmetic

2006-03-04 Thread Tuvas
Okay, I don't know if your farmiliar with the miller-rabin primality test, but it's what's called a probabalistic test. Meaning that trying it out once can give fake results. For instance, if you use the number 31 to test if 561 is prime, you will see the results say that it isn't. Mathematically,

Cryptographically random numbers

2006-03-04 Thread Tuvas
Okay, I'm working on devoloping a simple, cryptographically secure number, from a range of numbers (As one might do for finding large numbers, to test if they are prime). My function looks like this: def cran_rand(min,max): if(min>max): x=max max=min min=x range=rou

A simple question

2006-03-04 Thread Tuvas
I know the answer is probably really simple to this, and I feel bad to even ask, but I can't find the answer anywhere... Let me show what happened, then ask the question. >>> x=[[0]*2]*2 >>> x [[0, 0], [0, 0]] >>> x[0][1]=1 >>> x [[0, 1], [0, 1]] >>> The question now. Why is the output list [[0,

Re: A simple question

2006-03-04 Thread Tuvas
Ahh, that make sense! Thanks a ton! -- http://mail.python.org/mailman/listinfo/python-list

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
H. Well, I don't know what else I could do, except for to write a function that doesn't require recursion. Still, 300 digits isn't too bad... I have also realized that if you try is_prime(3) it will return false. I'll have to work on it... Thanks for the help! -- http://mail.python.org/mailma

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Yep, you guessed correctly about the s2num function, I knew I should have put a bit more.. It just converts an ascii string to a number, however many numbers that are nessicary. I could indeed check for all primes below a certain number, however, it still seems to run quite fast, at least to a 400

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Actually, it wasn't very nice, it returned composites instead of primes... There was alot of little bugs, I'm glad I checked it again. The new code once again is uploaded, the previews are on their way... I did set up a system to check for primality up to 1000, I think any more than that and it wil

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Although, I have to brag quickly, adding in this simple prime check speed up the algorithm to the point that it's actually faster to find a prime number with my program than to verify a number prime with GP/PARI, so, I feel good. -- http://mail.python.org/mailman/listinfo/python-list

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Bryan Olson wrote: > Tuvas wrote: > > Okay, I don't know if your farmiliar with the miller-rabin primality > > test, > > Paul is familiar with it. When he referred to your Miller-Rabin > test, he meant all the rounds. > > > but it's what's called

Re: Cryptographically random numbers

2006-03-05 Thread Tuvas
Good idea about the max and min values. Yes, urandom is os.urandom. s2num('blah') will convert the phrase blah to ascii, and treat them as if they were a big function. Anyone else whose still interested, I found another small bug, but it was in the modular (Again). It won't do much, but... I did

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Ahh, I see, I missed doing the last step in my M-R test. Hmmm. Well, got that one fixed now, time for a new release I guess. Sigh. I do seem to be going through them rather quickly... -- http://mail.python.org/mailman/listinfo/python-list

Re: Random Prime Generator/Modular Arithmetic

2006-03-05 Thread Tuvas
Okay, now I get the correct number of 561 pseudoprimes, 5, so I can assume that it is indeed working right. Whew. Thanks for the help on that one. Now, I only wish I could change the answer to my last homework assignment... Oh well. -- http://mail.python.org/mailman/listinfo/python-list

Re: Random Prime Generator/Modular Arithmetic

2006-03-06 Thread Tuvas
Actually, there was a small bug fix that I found, and I had a teacher who told me once that there was only 5 pseudoprimes. I realized that large numbers of prime numbers were returning false, and discovered the root of the problem, which was that my M-R test ended too late... But, it works now, tha

Re: Cryptographically random numbers

2006-03-06 Thread Tuvas
Ahh, you are correct, that is a large bug... How about this one? def s2num(text): if(len(text)==1): return ord(text) else: return ord(text[0])+256*s2num(text[1:]) def cran_rand(min,max): range=int(log(abs(max-min))/log(2))+1 num=max+1 if range%8==0: cra

Re: Cryptographically random numbers

2006-03-06 Thread Tuvas
Wait, I now see that there is a native base 2 log in python, so I will just do that rather than my adhoc way. The reason for adding one is to make sure there isn't any problems if the log is, for instance, 2.2. It will always round up. It's better to have to try twice to make sure the number can ha

Re: Cryptographically random numbers

2006-03-06 Thread Tuvas
Wow, that would have been nice to know... Oh well, I've already got the function, might as well use it... I'm starting to learn alot more of the standard libraries that exist for alot of the little functions. It seems like every project I have I build a misc.py file that contains several small, but

Re: Cryptographically random numbers

2006-03-06 Thread Tuvas
Thanks for the function Paul, it works alot nicer than the one I had in my program... Now, with all of this knowledge, I'm going to be brave and try out everything with AES. It seems to be working alright, I'll debug this more on my own than I did with my RSA code, which turned out to be full of bu

Re: Cryptographically random numbers

2006-03-07 Thread Tuvas
from os import urandom def cstring(bytes): ret='' while(len(ret)'0' and c<'z': ret=ret+c return ret That should do it, though I bet there might be a more efficient way. I don't know if that's the set of characters you want to use, but... If you want a better answer, you'd h

AES encryption

2006-03-07 Thread Tuvas
I have just finished a new function that will do AES128 encryption, which is the standard for private-key cryptology today. In fact, the NSA permitted AES to be used for classified documents in the USA, the first time a public algorithm has been given this honor (Secret and Top Secret documents can

Re: AES encryption

2006-03-07 Thread Tuvas
I don't know if it means anything, but the AES system that I have isn't set up to do anything other than 128 bit encryption at the moment, nor will it likely do so, mainly because most systems only explain how to get the 128 encryption, and not the larger sizes. I'm sure it's fairly easy to change,

Re: Cryptographically random numbers

2006-03-07 Thread Tuvas
I will admit though, I have the same question as Paul, why do you want a random string of numbers, letters, and symbols? But, you asked for it, so, that'll do. -- http://mail.python.org/mailman/listinfo/python-list

Re: Cryptographically random numbers

2006-03-07 Thread Tuvas
I've actually done the tests on this one, it's actually faster to use the += than a list, odd as it may sound. I ran into this one a while back. The best way to do it is to build an array from scratch, fill the array, and then join it, but I didn't have time to do it that way... -- http://mail.py

Re: AES encryption

2006-03-07 Thread Tuvas
Okay, I figured out the problem. The problem was that my algorythm filed the numbers into the matrix as so: 1 2 3 4 5 6 7 8... While it should have been 1 5 9 13 2 6 10 14 ... When this was fixed, the program works great! That's what I get for testing only asymetrical keys... Oh well, thanks for

Re: AES encryption

2006-03-07 Thread Tuvas
Ere, I mean testing only symetrical keys, and symetrical messages, nothing more realistic. Sigh. Oh well. It works, and that's the important thing. I don't know if I'll put in support for the larger key sizes, but, I'll leave it be for now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Password entering system

2006-03-09 Thread Tuvas
Thanks, that's exactly what I wanted! -- http://mail.python.org/mailman/listinfo/python-list

Password entering system

2006-03-10 Thread Tuvas
I want to write a GUI program (Preferably in Tkinter) that will allow for the entering of passwords, stared out like a normal program does. Is that possible? Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: Password entering system

2006-03-10 Thread Tuvas
I actually decided to write my own, the thing I needed to know was the show option to entry. That was the key! -- http://mail.python.org/mailman/listinfo/python-list

<    1   2