Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 16th, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Elegant way of chunking data
  2. i = 0
  3. while signature != '':
  4.    header_hash['Some-Authorization-' + i] = signature[:60]
  5.    signature = signature[60:]
  6.    i += 1
  7.        
  8. def hashing(header_hash, signature, hash_size):
  9.      for index, i in enumerate(xrange(len(signature), hash_size)):
  10.           header_hash['Some-Authorization-%s' % index] = signature[i:i+hash_size]