home *** CD-ROM | disk | FTP | other *** search
/ The Hacker's Encyclopedia 1998 / hackers_encyclopedia.iso / zines / n_z / piss0040.txt < prev    next >
Encoding:
Text File  |  2003-06-11  |  7.3 KB  |  253 lines

  1. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  2. -  P.I.S.S. Philez Number 40  =
  3. =                             -
  4. -   CRYPTOGRAPHY - an intro   =
  5. =                             -
  6. -       by PhrostByte         =
  7. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  8.  
  9. ------------------------
  10.  
  11. BASIC (GLR)
  12.  
  13. crypto is bein used more and more these days 'cause ppl want privacy.
  14. well, in this phile and maybe a few to come, i'll talk about a few general
  15. types of crypto, including a few examples.
  16.  
  17.  
  18. 1st let's look at one of the most basic types of crypto, general letter replacement.
  19. GLR werks like it sounds.  so i won't insult your intellegence.  instead i'll skip to an example.
  20.  
  21. message: slap mah fro
  22. alphabet key: fghijklmnopqrstuvwxyzabcde
  23. encrypted message: xqfu rfm kwt
  24.  
  25. as you can see, this is very ez to break using general logic, such as:
  26.  
  27. the most common 2 vowels: E A
  28. most common consonants: R S T L N
  29.  
  30. A common type of GLR is reverse alphabetic encryption.
  31. where 'a' corresponds to 'z' and 'y' to 'b' etc.......
  32. but this is probably the most simple type.  let's move on to matrices.
  33.  
  34. MATRICES
  35.  
  36. matrices, like magic, make encryption many times stronger than GLR does.  in fact, it is magic...
  37. and if you believe that load of bullshit then you MUST reformat your hard drive now...
  38. anyway, a basic matrix encryption type is polybius.  it uses a 5x5 matrix as shown below.
  39.  
  40.      1   2   3   4   5
  41.    #------------------
  42.    |
  43. 1  | a   b   c   d   e
  44.    |
  45. 2  | f   g   h  ij   k
  46.    |
  47. 3  | l   m   n   o   p
  48.    |
  49. 4  | q   r   s   t   u
  50.    |
  51. 5  | v   w   x   y   x
  52.  
  53.  
  54.  
  55. notice the 'i' and the 'j' share the same square and if you know basic math, you can figure out
  56. why.
  57.  
  58. so you get number coordinates for the letters.  but for more secure encryption, you need different
  59. matrices.  I would also now like to introduce keys.
  60.  
  61. vigenere encryption:
  62.  
  63. this is based on the following matrix:
  64.  
  65. ABCDEFGHIJKLMNOPQRSTUVWXYZ
  66. BCDEFGHIJKLMNOPQRSTUVWXYZA
  67. CDEFGHIJKLMNOPQRSTUVWXYZAB
  68. DEFGHIJKLMNOPQRSTUVWXYZABC
  69. EFGHIJKLMNOPQRSTUVWXYZABCD
  70. FGHIJKLMNOPQRSTUVWXYZABCDE
  71. GHIJKLMNOPQRSTUVWXYZABCDEF
  72. HIJKLMNOPQRSTUVWXYZABCDEFG
  73. IJKLMNOPQRSTUVWXYZABCDEFGH
  74. JKLMNOPQRSTUVWXYZABCDEFGHI
  75. KLMNOPQRSTUVWXYZABCDEFGHIJ
  76. LMNOPQRSTUVWXYZABCDEFGHIJK
  77. MNOPQRSTUVWXYZABCDEFGHIJKL
  78. NOPQRSTUVWXYZABCDEFGHIJKLM
  79. OPQRSTUVWXYZABCDEFGHIJKLMN
  80. PQRSTUVWXYZABCDEFGHIJKLMNO
  81. QRSTUVWXYZABCDEFGHIJKLMNOP
  82. RSTUVWXYZABCDEFGHIJKLMNOPQ
  83. STUVWXYZABCDEFGHIJKLMNOPQR
  84. TUVWXYZABCDEFGHIJKLMNOPQRS
  85. UVWXYZABCDEFGHIJKLMNOPQRST
  86. VWXYZABCDEFGHIJKLMNOPQRSTU
  87. WXYZABCDEFGHIJKLMNOPQRSTUV
  88. XYZABCDEFGHIJKLMNOPQRSTUVW
  89. YZABCDEFGHIJKLMNOPQRSTUVWX
  90. ZABCDEFGHIJKLMNOPQRSTUVWXY
  91.  
  92. next we take the message:
  93.  
  94. piss roxxors yer fro
  95.  
  96. and come up with a key:
  97.  
  98. defenestrator
  99.  
  100. then we do this:
  101.  
  102. piss roxxors yer fro
  103. defe nestrat ord efe
  104.  
  105. now we have the coordinates in the graph of the cipher text.  after that, we get the cipher using
  106. (column, row) substitution.
  107.  
  108. (p,d) (i,e) (s,f) (s,e) (r,n) (o,e) (x,s) (x,t) (o,r) (r,a) (s,t) (y,o) (e,r) (r,d) (f,e) (r,f) (o,e)
  109.  
  110. smxw espqfrl mvu jws
  111.  
  112. PLAYFAIR
  113.  
  114. playfair is actually one of my faves as far as simple matrix encryption goes.  first you come up
  115. with a key.
  116.  
  117. PHROSTBYTE
  118.  
  119. then you take out double letters:
  120.  
  121. PHROSTBYE
  122.  
  123. then you add all the missing alphabet letters to the matrix (except 'j' which is paired with 'i':
  124.  
  125. PHROSTBYE
  126. GXLNDUIQA
  127. WZCMVFK--
  128.  
  129. now you make another matrix (5x5) by reading the columns:
  130.  
  131. P G W H X
  132. Z R L C O
  133. N M S D V
  134. T U F B IJ
  135. K Y Q E A
  136.  
  137. now that we have our key matrix, we can encipher a message
  138.  
  139.  
  140. message: get cantaloop script
  141.  
  142. you find the letters for the encrypted text by first splitting it into 2 letter pairs:
  143.  
  144. ge tc an ta lo op sc ri pt
  145.  
  146. then you use the pattern of (row,column) (column,row) to find the cipher text.
  147.  
  148. row 'g' column 'e' = Y
  149. column 't' row 'c' = Z
  150. row 'a' column 'n' = K
  151. column 't' row 'a' = K
  152. row 'l' column 'o' = Z (note if two letters are in the same row, you take the letter to the right, and the matrix wraps around so we get 'Z')
  153. column 'o' row 'p' = X
  154. row 's' column 'c' = D
  155. column 'r' row 'i' = U
  156. row 'p' column 't' = K (likewise, if 2 letters are in the same column, take the letter below)
  157.  
  158. so the encrypted message is......
  159.  
  160. YZKKZXDUK
  161.  
  162. now if you really wanted to make the code hard to crack, you could encode the coded message again
  163. using playfair or another type of encoding.  i think it's useful to use a GLR on the code, then
  164. run it backwards and reencode it with playfair or another type.
  165.  
  166. now we get into very secure stuph.
  167.  
  168. GEOMETRIC ENCODING
  169.  
  170. This can be done in several ways.  The way i would generally use it is to take an already
  171. encoded message and do some GLR.  Then put it in a matrix like this (let's say we use the message
  172. "sacrifice your gerbil and submit to the fro gods they will straighten your crooked fro"):
  173.  
  174. s a c r i f i c e
  175. y o u r g e r b i
  176. l a n d s u b m i
  177. t t o t h e f r o
  178. g o d s t h e y w
  179. i l l s t r a i g
  180. h t e n y o u r c
  181. r o o k e d f r o
  182.  
  183. then you make a geometric key....which is basically a pattern you run through the matrix to
  184. include the entire message.
  185. I could go diagonally:
  186.  
  187. saycolruatirntgfgdooiiestdlhcruhsltrebbetseoimfhtnoirerykoyaoewiudgrfcro
  188.  
  189. or any number of the hundreds of millions of ways.
  190. this is an excellent way to encrypt when used in conjunction with other methods.
  191.  
  192. now go write a proggie that encrypts and decrypts.  remember, be creative, try new things, and
  193. make damn sure that if you write an encryption proggie it werks both ways before you destribute
  194. it to yer frendz dammit (assuming you have frendz).
  195.  
  196. cya in hell.
  197.  
  198. PhrostByte
  199.  
  200.  
  201.         _/_/_/_/_/_/       _/_/          _/_/_/_/_/            _/_/_/_/_/
  202.        _/_/     _/_/      _/_/         _/_/                  _/_/
  203.       _/_/     _/_/      _/_/        _/_/                  _/_/
  204.      _/_/    _/_/       _/_/         _/_/                  _/_/
  205.     _/_/_/_/_/         _/_/           _/_/_/_/              _/_/_/_/ 
  206.    _/_/               _/_/                _/_/                  _/_/  
  207.   _/_/               _/_/                  _/_/                  _/_/
  208.  _/_/       _/_/    _/_/    _/_/          _/_/   _/_/           _/_/   _/_/
  209. _/_/       _/_/    _/_/    _/_/   _/_/_/_/_/    _/_/   _/_/_/_/_/     _/_/
  210.  
  211. [Phrosty writes!  About time.  Nice ascii, he knows I can't draw worth
  212. shit.  Lots of hidden (not really) messages in here.  Hope he will write
  213. some software using this, because there's no way in hell I will. -Def]
  214.  
  215. ----------------------------------------------------------------------
  216. PISS - People into Serious Shit
  217.  
  218. Founderz - Defenestrator, PhrostByte
  219. Memberz - 
  220. Author Parselon
  221. Wu Forever
  222. kQs
  223. CGibbons
  224. Extinction
  225. Faekon/Homarid
  226. Grench
  227. Greenseed
  228. Tim 121
  229. Rhodekyll
  230. Dial Tone
  231. Psycho Phreak
  232. Djdude
  233. Circular Reclusion
  234. Havok Luther
  235. AT2Screech
  236.  
  237. Contributors- 
  238. Sameer Ketkar
  239. Phantom Operator
  240.  
  241. PISS, the author, and anyone else does not take responsibility for what
  242. you do with the stuph contained in this phile.  If you get busted, 
  243. don't cry to us.  We don't care.
  244.  
  245. Want more stuph?  Go to http://piss.home.ml.org
  246. The site will change as soon as Phantom Operator puts up his damn domain.
  247.  
  248. E-mail the group at davematthews@rocketmail.com
  249.  
  250. (C) Copyright 1997 PISS Publications and also copyrighted by the author.
  251. This file may be posted freely as long as this notice stays on the end.
  252. All rights reserved.
  253.