943,096 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 700
  • Python RSS
Jan 25th, 2010
0

tea decryption algorithm

Expand Post »
despite its simplicity, for some reason, my code refuses to work, even though the encryption works
Python Syntax (Toggle Plain Text)
  1. # add() is just (a+b)%2**32. for some reason, without the function, it doesnt work
  2. delta = 0x9e3779b9
  3. sum = 0xc6ef3720
  4. for x in range(cycles): # 32
  5. data[1] = add(-add(data[0]<<4, key[2]) ^ add(data[0], sum) ^ add(data[0]>>5, key[3]), data[1])
  6. data[0] = add(-add(data[1]<<4, key[0]) ^ add(data[1], sum) ^ add(data[1]>>5, key[1]), data[0])
  7. sum -= delta
can anyone tell me why?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Light Poster
calccrypto is offline Offline
35 posts
since Nov 2009
Jan 25th, 2010
0
Re: tea decryption algorithm
What's key?
Avoid using sum since it is Python function, could get you into trouble later.
Reputation Points: 404
Solved Threads: 180
Nearly a Posting Virtuoso
bumsfeld is offline Offline
1,422 posts
since Jul 2005
Jan 25th, 2010
0
Re: tea decryption algorithm
key is a 128 bit value, split into 4 32-bit values

i dont really thing sum causes any problems. the encryption part of if, which also uses sum works. besides, this is more or less the entire code. the rest of it is changing the values into hex and putting them together
Reputation Points: 10
Solved Threads: 1
Light Poster
calccrypto is offline Offline
35 posts
since Nov 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: python-django & if sequences
Next Thread in Python Forum Timeline: Tkinter/PIL, Drag n Drop image with mouse





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC