Advertisement
Guest User

xsackbydro

a guest
Apr 10th, 2017
341
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.11 KB | None | 0 0
  1. X-SACK
  2. This cipher is based on crossed substitution of the message and on simple substitution of the key.
  3. Let’s explain it with an example.
  4. Our message is:
  5. msg = “Attack now”
  6. Our key is:
  7. key=”secret”
  8. Our secure-key (you’ll see the meaning later) is:
  9. skey=”cryp”
  10. Before starting, you have to assign to each letter of the alphabet (and also to numbers and symbols if you use them) a number. In a software, it could be the ASCII value of the character. Let’s use a simple one as example, though it’s a valid one.
  11. 0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z _ ? .
  12. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
  13.  
  14. First of all, you need to split msg separating each letter:
  15. a t t a c k _ n o w
  16. NOTE: space is a valid character, so i used “_” just to show it
  17. Now substitute to each letter its number:
  18. 10 29 29 11 13 20 36 23 24 32
  19. You’ll do the same thing with the key:
  20. s e c r e t
  21. 28 14 12 27 14 29
  22. Now you have to split the key in two parts:
  23. s e c | r e t
  24. 28 14 12 27 14 29
  25.  
  26. Time to substitute! To perform a cross substition, add to the first msg value the first key value of the first group (a+s), then add to the second msg value the first key value of the second group (t+r), continue adding to the third msg value the second key value of the first group, then to the fourth msg value the second key value of the second group and so on. Restart from the beginning if the key ends.
  27. Practical example:
  28.  
  29. A T T A C K _ N O W
  30. + + + + + + + + + +
  31. S R E E C T S R E E
  32.  
  33. Obviously you will use the numbers instead of the letters, so the result is:
  34. 10+ 29+ 29+ 10+ 13+ 20+ 36+ 23+ 24+ 32+
  35. 28= 27= 14= 14= 12= 29= 28= 27= 14= 14=
  36. 38 56 43 24 25 49 64 50 38 46
  37.  
  38. The last step is to calculate a sort of checksum of our key and add it to each number:
  39. 28+14+12+27+14+29 = 124
  40.  
  41. 38 56 43 24 25 49 64 50 38 46
  42. 124 124 124 124 124 124 124 124 124 124
  43. 162 180 167 148 149 173 188 174 162 170
  44.  
  45. Now you should reconvert numbers to letters. If the number exceed the limit of your alphabet, simple start counting from the beginning:
  46. Limit: 38
  47. 162 180 167 148 149 173 188 174 162 170
  48. Is Is Is Is Is Is Is Is Is Is
  49. 10 28 15 34 35 21 36 22 20 18
  50.  
  51. Let’s decode:
  52.  
  53. 10 28 15 34 35 21 36 22 20 18
  54. A S F Y Z L _ M K I
  55.  
  56. The encrypted message is:
  57. ASFYZL_MKI
  58. Though is really hard to decode the message without having the key, even having a large amount of text, the last step is to encode also the key, with the secure key. The steps are almost the same, but you don’t have to split the secure key. Simple substitute, check the values and then reconvert.
  59.  
  60. S E C R E T
  61. 28 14 12 27 14 29
  62. C R Y P C R
  63. 12 27 34 25 12 27
  64. 40 -> 41 -> 46 -> 52 -> 26 -> 56 ->
  65. 2 3 8 14 26 18
  66. 2 3 8 E Q I
  67.  
  68. So, the encoded key is:
  69. 238EQI
  70.  
  71. The only way to decrypt the message is having the msg, the encoded key and the secure key, or the plain key if you are so dumb to give the plain one.
  72.  
  73. Give to your friend:
  74. ASFYZL_MKI
  75. 238EQI
  76. CRYP
  77. And he will be able to read “attack now”.
  78.  
  79. Regards,
  80. DrO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement