Advertisement
cmiN

lymd

Aug 2nd, 2011
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. #! /usr/bin/env python
  2. ## Listen your md5
  3. ## 02.08.2011 cmiN
  4.  
  5. from sys import argv
  6. from winsound import Beep
  7. from hashlib import md5
  8.  
  9. def init():
  10.     global notes
  11.     N, L = 100, 150 # frequency coefficient and period (N between 40 and 1300)
  12.     chars = filter(str.isalnum, [chr(i) for i in xrange(ord("0"), ord("F") + 1)])
  13.     notes = dict([(k, "Beep(%d, %d)" % ((ord(k) - ord("0")) * N + N, L)) for k in chars])
  14.  
  15. def process(param):
  16.     for i in md5(param).hexdigest().upper():
  17.         eval(notes[i])
  18.  
  19. def main():
  20.     if len(argv) != 2:
  21.         print "Usage: ./script.py string"
  22.     else:
  23.         init()
  24.         process(argv[1])
  25.  
  26. if __name__ == "__main__":
  27.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement