• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PI text encrypter for the insomniac.
#1
Last year, I posted some encrypted text here to see if any Mcomputers had a 'Good Will Hunting Beautiful Mind.' Evidently not. Since I wrote the encrypter in Python 2.6, it seemed fitting to post the source here. This program has no useful function unless you are passing secret messages to your buddy who possesses the same script possibly via email, but it was fun to dream up and write. There are a few artifacts in the decryption, but it is plenty readable. Play with it, it is fun.

Code:
string=raw_input('Enter the text to be encrypted or you will die: ')
newstring=''
length=len(string)
print length
print
pi='314159265358979323846264338327950'
pipos=0
for num in range(0,length):
    val=ord(string[num])
    pival=ord(pi[pipos])-48
    print chr(val+pival),''' change the + to - while decrypting this line isn't even needed- more like a progress bar- something to look at'''
    if string[num]!=' ':newstring=newstring+chr(val+pival)# change the + to - to decrypt
    else:newstring=newstring+' '
    if pipos==32:
  pipos=0
    else: pipos=pipos+1
print
print
print newstring
print

I picked that position of pi truncation because it is at that point the first zero occurs and I wanted all the numbers of the decimal system represented therein.
Having long hair is great until you have to pull a footlong out of the dog's butt. flatank.blogspot.com
I. AM. LATCH.
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Write textbox text to a text file [VB.NET] Clones 2 14,019 02-12-2011, 02:32 AM
Last Post: latch

Forum Jump: