Advertisement
Xenithz

Simple Homophonic Encrypt

Feb 11th, 2012
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.93 KB | None | 0 0
  1. from random import randint
  2. mykey = {
  3. "A":[1,2,3,4,5],
  4. "B":[11,12,13,14,15],
  5. "C":[21,22,23],
  6. "D":[31,32,33],
  7. "E":[41,42,43],
  8. "F":[51,52,53],
  9. "G":[61,62,63],
  10. "H":[71,72,73],
  11. "I":[81,82,83],
  12. "J":[91,92,93],
  13. "K":[101,102,103],
  14. "L":[111,112,113],
  15. "M":[121,122,123],
  16. "N":[131,132,133],
  17. "O":[141,142,143],
  18. "P":[151,152,153],
  19. "Q":[161,162,163],
  20. "R":[171,172,173],
  21. "S":[181,182,183],
  22. "T":[191,192,193],
  23. "U":[201,202,203],
  24. "V":[211,212,213],
  25. "W":[221,222,223],
  26. "X":[231,232,233],
  27. "Y":[241,242,243],
  28. "Z":[251,252,253]
  29. }
  30. word = raw_input("Input some Text : ").upper()
  31. cipher = [mykey[char][randint(0, len(mykey[char])-1)] for char in word]
  32. print "Cipher Text [%s] is = %s"%(word,cipher)
  33.  
  34. """
  35. *****Debug Mode******
  36. $ python homo_poc.py
  37. Input some Text : homophonic
  38. H => 73
  39. O => 142
  40. M => 122
  41. O => 143
  42. P => 151
  43. H => 73
  44. O => 142
  45. N => 131
  46. I => 81
  47. C => 21
  48. Cipher Text is = [73, 142, 122, 143, 151, 73, 142, 131, 81, 21]
  49. """
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement