Hex Artifact Content
Not logged in

Artifact 9922ed43c814340feaf3771dd82eff7245d3704f:


0000: 23 20 45 6e 63 72 79 70 74 69 6f 6e 20 23 0a 0a  # Encryption #..
0010: 54 6f 20 70 72 6f 74 65 63 74 20 70 72 69 76 61  To protect priva
0020: 63 79 2c 20 65 76 65 72 79 74 68 69 6e 67 20 69  cy, everything i
0030: 73 20 65 6e 63 72 79 70 74 65 64 20 77 69 74 68  s encrypted with
0040: 20 74 68 65 20 73 74 72 6f 6e 67 65 73 74 20 65   the strongest e
0050: 6e 63 72 79 70 74 69 6f 6e 0a 61 76 61 69 6c 61  ncryption.availa
0060: 62 6c 65 2e 20 54 68 65 20 72 65 61 73 6f 6e 73  ble. The reasons
0070: 20 66 6f 72 20 73 65 6c 65 63 74 69 6e 67 20 74   for selecting t
0080: 68 65 20 61 6c 67 6f 72 69 74 68 6d 73 20 77 65  he algorithms we
0090: 72 65 3a 0a 0a 23 23 20 4b 65 79 20 45 78 63 68  re:..## Key Exch
00a0: 61 6e 67 65 20 61 6e 64 20 53 69 67 6e 61 74 75  ange and Signatu
00b0: 72 65 73 20 23 23 0a 0a 2a 20 52 53 41 3a 20 52  res ##..* RSA: R
00c0: 65 61 73 6f 6e 61 62 6c 65 20 28 31 32 38 62 69  easonable (128bi
00d0: 74 29 20 73 74 72 65 6e 67 74 68 20 72 65 71 75  t) strength requ
00e0: 69 72 65 73 20 61 74 20 6c 65 61 73 74 20 33 6b  ires at least 3k
00f0: 62 69 74 20 6b 65 79 20 73 69 7a 65 3b 0a 20 20  bit key size;.  
0100: 66 61 63 74 6f 72 69 6e 67 20 69 73 20 6e 6f 74  factoring is not
0110: 20 61 73 20 68 61 72 64 20 61 73 20 6f 72 69 67   as hard as orig
0120: 69 6e 61 6c 6c 79 20 61 73 73 75 6d 65 64 3b 20  inally assumed; 
0130: 74 68 65 20 61 6c 67 6f 72 69 74 68 6d 20 61 72  the algorithm ar
0140: 65 20 73 74 69 6c 6c 0a 20 20 61 62 6f 76 65 20  e still.  above 
0150: 70 6f 6c 79 6e 6f 6d 69 61 6c 2c 20 62 75 74 20  polynomial, but 
0160: 77 61 79 20 62 65 6c 6f 77 20 62 72 75 74 65 20  way below brute 
0170: 66 6f 72 63 65 2c 20 61 6e 64 20 61 6e 79 20 66  force, and any f
0180: 75 72 74 68 65 72 20 62 72 65 61 6b 74 68 72 6f  urther breakthro
0190: 75 67 68 0a 20 20 77 69 6c 6c 20 72 65 71 75 69  ugh.  will requi
01a0: 72 65 20 74 6f 20 69 6e 63 72 65 61 73 65 20 74  re to increase t
01b0: 68 65 20 6b 65 79 20 73 69 7a 65 20 74 6f 20 75  he key size to u
01c0: 6e 72 65 61 73 6f 6e 61 62 6c 65 20 6c 69 6d 69  nreasonable limi
01d0: 74 73 2e 20 57 69 74 68 20 61 20 34 6b 62 69 74  ts. With a 4kbit
01e0: 0a 20 20 6b 65 79 20 28 35 31 32 20 62 79 74 65  .  key (512 byte
01f0: 73 20 70 65 72 20 6b 65 79 29 2c 20 74 68 65 20  s per key), the 
0200: 63 6f 6e 6e 65 63 74 69 6f 6e 20 73 65 74 75 70  connection setup
0210: 20 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 77 6f 6e   information won
0220: 27 74 20 66 69 74 20 69 6e 74 6f 20 74 68 65 0a  't fit into the.
0230: 20 20 31 6b 42 20 70 61 63 6b 65 74 73 2e 0a 2a    1kB packets..*
0240: 20 44 69 66 66 69 65 2d 48 65 6c 6c 6d 61 6e 20   Diffie-Hellman 
0250: 64 69 73 63 72 65 74 65 20 6c 6f 67 61 72 69 74  discrete logarit
0260: 68 6d 20 68 61 73 20 65 73 73 65 6e 74 69 61 6c  hm has essential
0270: 6c 79 20 74 68 65 20 73 61 6d 65 20 73 74 72 65  ly the same stre
0280: 6e 67 74 68 20 61 73 20 52 53 41 2e 0a 2a 20 45  ngth as RSA..* E
0290: 6c 6c 69 70 74 69 63 20 43 75 72 76 65 20 43 72  lliptic Curve Cr
02a0: 79 70 74 6f 67 72 61 70 68 79 20 69 73 20 73 74  yptography is st
02b0: 69 6c 6c 20 63 6f 6e 73 69 64 65 72 65 64 20 22  ill considered "
02c0: 73 74 72 6f 6e 67 22 2c 20 69 2e 65 2e 20 74 68  strong", i.e. th
02d0: 65 72 65 20 69 73 20 6f 6e 6c 79 0a 20 20 74 68  ere is only.  th
02e0: 65 20 76 65 72 79 20 67 65 6e 65 72 69 63 20 62  e very generic b
02f0: 69 67 2f 6c 69 74 74 6c 65 20 73 74 65 70 20 61  ig/little step a
0300: 74 74 61 63 6b 2c 20 77 68 69 63 68 20 6d 65 61  ttack, which mea
0310: 6e 73 20 61 20 32 35 36 20 62 69 74 20 6b 65 79  ns a 256 bit key
0320: 20 65 71 75 61 6c 73 0a 20 20 31 32 38 20 62 69   equals.  128 bi
0330: 74 20 73 74 72 65 6e 67 74 68 2e 0a 0a 54 68 65  t strength...The
0340: 20 73 65 6c 65 63 74 69 6f 6e 20 74 68 65 72 65   selection there
0350: 66 6f 72 65 20 77 61 73 20 45 64 32 35 35 31 39  fore was Ed25519
0360: 2c 20 61 20 45 64 77 61 72 64 73 20 66 6f 72 6d  , a Edwards form
0370: 20 76 61 72 69 61 6e 74 20 6f 66 20 44 61 6e 20   variant of Dan 
0380: 42 65 72 6e 73 74 65 69 6e 27 73 0a 63 75 72 76  Bernstein's.curv
0390: 65 32 35 35 31 39 2e 20 20 45 64 77 61 72 64 73  e25519.  Edwards
03a0: 20 66 6f 72 6d 20 69 73 20 6e 6f 74 61 74 69 6f   form is notatio
03b0: 6e 61 6c 6c 79 20 73 69 6d 70 6c 65 72 20 61 6e  nally simpler an
03c0: 64 20 72 65 67 75 6c 61 72 20 74 68 61 6e 20 6f  d regular than o
03d0: 74 68 65 72 0a 63 75 72 76 65 73 2c 20 61 6c 6c  ther.curves, all
03e0: 6f 77 69 6e 67 20 6d 6f 72 65 20 6f 70 74 69 6d  owing more optim
03f0: 69 7a 61 74 69 6f 6e 73 2e 20 20 54 68 65 20 70  izations.  The p
0400: 61 72 61 6d 65 74 65 72 73 20 6f 66 20 74 68 69  arameters of thi
0410: 73 20 63 75 72 76 65 20 61 72 65 0a 6b 6e 6f 77  s curve are.know
0420: 6e 2d 67 6f 6f 64 2c 20 66 6f 6c 6c 6f 77 69 6e  n-good, followin
0430: 67 20 74 68 65 20 22 6e 6f 74 68 69 6e 67 20 75  g the "nothing u
0440: 70 20 6d 79 20 73 6c 65 65 76 65 22 20 70 72 69  p my sleeve" pri
0450: 6e 63 69 70 6c 65 2e 0a 0a 23 23 23 20 4b 65 79  nciple...### Key
0460: 20 45 78 63 68 61 6e 67 65 20 50 72 6f 63 65 64   Exchange Proced
0470: 75 72 65 20 23 23 23 0a 0a 54 68 65 20 66 69 72  ure ###..The fir
0480: 73 74 20 70 68 61 73 65 20 6f 66 20 61 20 6b 65  st phase of a ke
0490: 79 20 65 78 63 68 61 6e 67 65 20 75 73 65 73 20  y exchange uses 
04a0: 65 70 68 65 6d 65 72 61 6c 20 28 6f 6e 65 2d 74  ephemeral (one-t
04b0: 69 6d 65 29 20 6b 65 79 73 2e 20 4c 65 74 27 73  ime) keys. Let's
04c0: 20 63 61 6c 6c 0a 74 68 65 20 69 6e 69 74 69 61   call.the initia
04d0: 74 6f 72 20 41 6c 69 63 65 2c 20 61 6e 64 20 74  tor Alice, and t
04e0: 68 65 20 63 6f 6e 6e 65 63 74 65 64 20 64 65 76  he connected dev
04f0: 69 63 65 20 42 6f 62 3a 0a 0a 31 2e 20 41 6c 69  ice Bob:..1. Ali
0500: 63 65 20 67 65 6e 65 72 61 74 65 73 20 61 20 6b  ce generates a k
0510: 65 79 20 70 61 69 72 2c 20 61 6e 64 20 73 65 6e  ey pair, and sen
0520: 64 73 20 42 6f 62 20 74 68 65 20 70 75 62 6c 69  ds Bob the publi
0530: 63 20 6b 65 79 2c 20 74 6f 67 65 74 68 65 72 20  c key, together 
0540: 77 69 74 68 20 61 0a 20 20 20 63 6f 6e 6e 65 63  with a.   connec
0550: 74 69 6f 6e 20 72 65 71 75 65 73 74 2e 0a 31 2e  tion request..1.
0560: 20 42 6f 62 20 63 72 65 61 74 65 73 20 61 20 6b   Bob creates a k
0570: 65 79 20 70 61 69 72 20 61 6e 64 20 73 65 6e 64  ey pair and send
0580: 73 20 41 6c 69 63 65 20 74 68 65 20 70 75 62 6c  s Alice the publ
0590: 69 63 20 6b 65 79 2e 20 55 73 69 6e 67 20 74 68  ic key. Using th
05a0: 69 73 20 70 75 62 6c 69 63 0a 20 20 20 61 6e 64  is public.   and
05b0: 20 73 65 63 72 65 74 20 6b 65 79 2c 20 68 65 20   secret key, he 
05c0: 67 65 6e 65 72 61 74 65 73 20 61 20 73 68 61 72  generates a shar
05d0: 65 64 20 73 65 63 72 65 74 31 2c 20 61 6e 64 20  ed secret1, and 
05e0: 75 73 65 73 20 74 68 61 74 20 74 6f 20 65 6e 63  uses that to enc
05f0: 72 79 70 74 20 68 69 73 0a 20 20 20 70 65 72 6d  rypt his.   perm
0600: 61 6e 65 6e 74 20 70 75 62 6c 69 63 20 6b 65 79  anent public key
0610: 20 28 75 73 65 64 20 66 6f 72 20 61 75 74 68 65   (used for authe
0620: 6e 74 69 63 61 74 69 6f 6e 29 2e 20 41 6e 20 61  ntication). An a
0630: 74 74 61 63 6b 65 72 20 63 61 6e 20 73 65 65 20  ttacker can see 
0640: 74 68 65 0a 20 20 20 65 70 68 65 6d 65 72 61 6c  the.   ephemeral
0650: 20 6b 65 79 2c 20 62 75 74 20 6e 6f 74 20 74 68   key, but not th
0660: 65 20 70 65 72 6d 61 6e 65 6e 74 20 70 75 62 6b  e permanent pubk
0670: 65 79 2e 20 20 42 6f 62 20 70 75 74 73 20 68 69  ey.  Bob puts hi
0680: 73 20 73 74 61 74 65 20 69 6e 20 61 6e 0a 20 20  s state in an.  
0690: 20 65 6e 63 72 79 70 74 65 64 20 73 74 72 69 6e   encrypted strin
06a0: 67 20 77 68 65 72 65 20 6f 6e 6c 79 20 42 6f 62  g where only Bob
06b0: 20 6b 6e 6f 77 73 20 74 68 65 20 6b 65 79 2c 20   knows the key, 
06c0: 61 6e 64 20 73 65 6e 64 73 20 74 68 69 73 20 22  and sends this "
06d0: 74 69 63 6b 65 74 22 20 62 61 63 6b 0a 20 20 20  ticket" back.   
06e0: 74 6f 20 41 6c 69 63 65 2e 20 20 52 65 63 65 69  to Alice.  Recei
06f0: 76 69 6e 67 20 74 68 65 20 74 69 63 6b 65 74 20  ving the ticket 
0700: 77 69 6c 6c 20 61 63 74 75 61 6c 6c 79 20 6f 70  will actually op
0710: 65 6e 20 75 70 20 74 68 65 20 63 6f 6e 6e 65 63  en up the connec
0720: 74 69 6f 6e 2e 0a 31 2e 20 41 6c 69 63 65 20 72  tion..1. Alice r
0730: 65 63 65 69 76 65 73 20 62 6f 74 68 20 6b 65 79  eceives both key
0740: 73 20 61 6e 64 20 63 61 6e 20 6e 6f 77 20 63 72  s and can now cr
0750: 65 61 74 65 20 74 77 6f 20 73 68 61 72 65 64 20  eate two shared 
0760: 73 65 63 72 65 74 73 3a 20 73 65 63 72 65 74 31  secrets: secret1
0770: 20 69 73 0a 20 20 20 74 68 65 20 65 70 68 65 6d   is.   the ephem
0780: 65 72 61 6c 20 73 65 63 72 65 74 2c 20 73 65 63  eral secret, sec
0790: 72 65 74 32 20 69 73 20 74 68 65 20 61 75 74 68  ret2 is the auth
07a0: 65 6e 74 69 63 61 74 69 6f 6e 20 73 65 63 72 65  entication secre
07b0: 74 2e 20 20 53 68 65 20 73 65 6e 64 73 20 68 65  t.  She sends he
07c0: 72 0a 20 20 20 61 75 74 68 65 6e 74 69 63 61 74  r.   authenticat
07d0: 69 6f 6e 20 70 75 62 6b 65 79 20 62 61 63 6b 20  ion pubkey back 
07e0: 74 6f 20 42 6f 62 20 65 6e 63 72 79 70 74 65 64  to Bob encrypted
07f0: 20 77 69 74 68 20 73 65 63 72 65 74 31 2e 20 20   with secret1.  
0800: 54 68 69 73 20 61 6c 6c 6f 77 73 20 42 6f 62 0a  This allows Bob.
0810: 20 20 20 74 6f 20 63 6f 6d 70 75 74 65 20 73 65     to compute se
0820: 63 72 65 74 32 2e 20 20 46 75 72 74 68 65 72 6d  cret2.  Furtherm
0830: 6f 72 65 2c 20 41 6c 69 63 65 20 73 65 6e 64 73  ore, Alice sends
0840: 20 62 61 63 6b 20 42 6f 62 27 73 20 74 69 63 6b   back Bob's tick
0850: 65 74 20 61 6e 64 20 61 0a 20 20 20 72 61 6e 64  et and a.   rand
0860: 6f 6d 20 70 65 72 2d 63 6f 6e 6e 65 63 74 69 6f  om per-connectio
0870: 6e 20 73 65 65 64 20 66 6f 72 20 74 68 65 20 73  n seed for the s
0880: 79 6d 6d 65 74 72 69 63 20 6b 65 79 73 3b 20 74  ymmetric keys; t
0890: 68 65 20 74 69 63 6b 65 74 20 63 61 6e 20 62 65  he ticket can be
08a0: 20 28 69 6e 0a 20 20 20 74 68 65 6f 72 79 29 20   (in.   theory) 
08b0: 75 73 65 64 20 74 6f 20 6f 70 65 6e 20 73 65 76  used to open sev
08c0: 65 72 61 6c 20 63 6f 6e 6e 65 63 74 69 6f 6e 73  eral connections
08d0: 20 74 6f 20 42 6f 62 20 77 69 74 68 20 61 20 73   to Bob with a s
08e0: 69 6e 67 6c 65 20 70 61 63 6b 65 74 20 28 6e 6f  ingle packet (no
08f0: 0a 20 20 20 72 65 70 6c 79 20 72 65 71 75 69 72  .   reply requir
0900: 65 64 29 2e 0a 0a 54 68 65 20 67 65 6e 65 72 61  ed)...The genera
0910: 6c 20 66 6f 72 6d 75 6c 61 20 66 6f 72 20 45 43  l formula for EC
0920: 43 20 44 69 66 66 69 65 2d 48 65 6c 6c 6d 61 6e  C Diffie-Hellman
0930: 20 6b 65 79 20 65 78 63 68 61 6e 67 65 20 69 73   key exchange is
0940: 20 5f 73 65 63 72 65 74 20 3d 0a 70 6b 31 5c 2a   _secret =.pk1\*
0950: 28 73 6b 32 29 20 3d 20 70 6b 32 5c 2a 28 73 6b  (sk2) = pk2\*(sk
0960: 31 29 5f 2e 20 46 6f 72 20 73 65 63 72 65 74 32  1)_. For secret2
0970: 2c 20 49 20 6d 6f 64 69 66 79 20 74 68 69 73 20  , I modify this 
0980: 74 6f 20 61 76 6f 69 64 20 73 69 64 65 2d 63 68  to avoid side-ch
0990: 61 6e 6e 65 6c 0a 61 74 74 61 63 6b 73 20 69 6e  annel.attacks in
09a0: 20 74 68 65 20 6c 65 6e 67 74 68 79 20 63 75 72   the lengthy cur
09b0: 76 65 20 70 6f 69 6e 74 20 63 6f 6d 70 75 74 61  ve point computa
09c0: 74 69 6f 6e 2c 20 61 6e 64 20 75 73 65 20 5f 73  tion, and use _s
09d0: 65 63 72 65 74 32 20 3d 0a 70 6b 61 5c 2a 28 73  ecret2 =.pka\*(s
09e0: 6b 62 5c 2a 73 65 63 72 65 74 31 29 20 3d 20 70  kb\*secret1) = p
09f0: 6b 62 5c 2a 28 73 6b 61 5c 2a 73 65 63 72 65 74  kb\*(ska\*secret
0a00: 31 29 5f 2e 20 20 54 68 65 20 73 63 61 6c 61 72  1)_.  The scalar
0a10: 20 6d 75 6c 74 69 70 6c 69 63 61 74 69 6f 6e 20   multiplication 
0a20: 69 6e 20 6d 6f 64 0a 5f 6c 5f 20 28 74 68 65 20  in mod._l_ (the 
0a30: 6e 75 6d 62 65 72 20 6f 66 20 63 75 72 76 65 20  number of curve 
0a40: 70 6f 69 6e 74 73 29 20 69 73 20 6d 75 63 68 20  points) is much 
0a50: 66 61 73 74 65 72 20 74 68 61 6e 20 74 68 65 20  faster than the 
0a60: 63 75 72 76 65 20 70 6f 69 6e 74 0a 63 6f 6d 70  curve point.comp
0a70: 75 74 61 74 69 6f 6e 2c 20 61 6e 64 20 69 73 20  utation, and is 
0a80: 6d 75 63 68 20 6c 65 73 73 20 6c 69 6b 65 6c 79  much less likely
0a90: 20 74 6f 20 6c 65 61 6b 20 69 6e 66 6f 72 6d 61   to leak informa
0aa0: 74 69 6f 6e 2e 0a 0a 23 23 20 53 79 6d 6d 65 74  tion...## Symmet
0ab0: 72 69 63 20 43 72 79 70 74 6f 20 23 23 0a 0a 54  ric Crypto ##..T
0ac0: 68 65 20 72 65 71 75 69 72 65 6d 65 6e 74 20 69  he requirement i
0ad0: 73 20 41 45 41 44 3a 20 41 75 74 68 65 6e 74 69  s AEAD: Authenti
0ae0: 63 61 74 65 20 61 6e 64 20 65 6e 63 72 79 70 74  cate and encrypt
0af0: 2f 64 65 63 72 79 70 74 0a 74 6f 67 65 74 68 65  /decrypt.togethe
0b00: 72 2e 20 20 43 61 6e 64 69 64 61 74 65 73 20 77  r.  Candidates w
0b10: 65 72 65 3a 0a 0a 2a 20 41 45 53 20 69 6e 20 43  ere:..* AES in C
0b20: 47 4d 20 e2 80 94 20 74 68 69 73 20 68 61 73 20  GM — this has 
0b30: 74 77 6f 20 70 72 6f 62 6c 65 6d 73 2e 0a 20 20  two problems..  
0b40: 31 2e 20 43 47 4d 20 69 73 20 6e 6f 74 20 61 20  1. CGM is not a 
0b50: 73 65 63 75 72 65 20 68 61 73 68 2c 20 61 6e 64  secure hash, and
0b60: 20 74 68 65 20 47 46 28 32 5e 6e 29 20 66 69 65   the GF(2^n) fie
0b70: 6c 64 20 75 73 65 64 20 67 69 76 65 73 20 20 73  ld used gives  s
0b80: 65 63 75 72 69 74 79 0a 20 20 20 20 20 6c 65 76  ecurity.     lev
0b90: 65 6c 20 6f 66 20 6f 6e 6c 79 20 61 62 6f 75 74  el of only about
0ba0: 20 36 34 20 62 69 74 73 20 66 6f 72 20 31 32 38   64 bits for 128
0bb0: 20 62 69 74 73 20 63 68 65 63 6b 73 75 6d 2e 0a   bits checksum..
0bc0: 20 20 32 2e 20 41 45 53 20 75 73 65 73 20 61 20    2. AES uses a 
0bd0: 63 6f 6e 73 74 61 6e 74 20 6b 65 79 2c 20 61 6e  constant key, an
0be0: 64 20 74 68 65 72 65 66 6f 72 65 2c 20 73 69 64  d therefore, sid
0bf0: 65 2d 63 68 61 6e 6e 65 6c 20 61 74 74 61 63 6b  e-channel attack
0c00: 73 20 61 72 65 20 6d 6f 72 65 0a 20 20 20 20 20  s are more.     
0c10: 6c 69 6b 65 6c 79 20 74 6f 20 73 75 63 63 65 65  likely to succee
0c20: 64 2e 0a 2a 20 78 73 61 6c 73 61 2f 73 61 6c 73  d..* xsalsa/sals
0c30: 61 32 30 2b 70 6f 6c 79 31 33 30 35 3a 20 54 68  a20+poly1305: Th
0c40: 69 73 20 75 73 65 73 20 61 20 73 74 72 65 61 6d  is uses a stream
0c50: 20 63 69 70 68 65 72 20 61 6e 64 20 61 20 47 46   cipher and a GF
0c60: 28 70 29 20 70 6f 6c 79 6e 6f 6d 2c 0a 20 20 77  (p) polynom,.  w
0c70: 68 69 63 68 20 70 72 6f 76 69 64 65 73 20 66 75  hich provides fu
0c80: 6c 6c 20 31 32 38 20 62 69 74 20 73 65 63 75 72  ll 128 bit secur
0c90: 69 74 79 20 66 6f 72 20 74 68 65 20 31 32 38 20  ity for the 128 
0ca0: 62 69 74 20 63 68 65 63 6b 73 75 6d 2c 20 62 75  bit checksum, bu
0cb0: 74 20 74 68 65 0a 20 20 73 65 63 75 72 69 74 79  t the.  security
0cc0: 20 6f 66 20 74 68 65 20 63 68 65 63 6b 73 75 6d   of the checksum
0cd0: 20 64 65 70 65 6e 64 73 20 6f 6e 20 74 68 65 20   depends on the 
0ce0: 65 6e 63 72 79 70 74 69 6f 6e 2e 20 20 54 68 65  encryption.  The
0cf0: 72 65 27 73 20 61 20 6c 6f 77 20 72 69 73 6b 20  re's a low risk 
0d00: 74 68 61 74 0a 20 20 74 68 65 20 70 72 6f 6f 66  that.  the proof
0d10: 20 68 65 72 65 20 69 73 20 62 61 73 69 6e 67 20   here is basing 
0d20: 6f 6e 20 77 72 6f 6e 67 20 61 73 73 75 6d 70 74  on wrong assumpt
0d30: 69 6f 6e 73 2e 20 20 41 73 20 61 20 73 74 72 65  ions.  As a stre
0d40: 61 6d 20 63 69 70 68 65 72 2c 20 74 68 65 72 65  am cipher, there
0d50: 20 69 73 0a 20 20 6e 6f 20 63 6f 6e 73 74 61 6e   is.  no constan
0d60: 74 20 6b 65 79 2c 20 73 6f 20 73 69 64 65 2d 63  t key, so side-c
0d70: 68 61 6e 6e 65 6c 20 61 74 74 61 63 6b 73 20 61  hannel attacks a
0d80: 72 65 20 6d 6f 72 65 20 64 69 66 66 69 63 75 6c  re more difficul
0d90: 74 2e 20 20 54 68 69 73 0a 20 20 63 6f 6d 62 69  t.  This.  combi
0da0: 6e 61 74 69 6f 6e 20 77 69 6e 73 20 6f 76 65 72  nation wins over
0db0: 20 41 45 53 2f 43 47 4d 2e 0a 2a 20 4b 65 63 63   AES/CGM..* Kecc
0dc0: 61 6b 20 69 6e 20 64 75 70 6c 65 78 20 6d 6f 64  ak in duplex mod
0dd0: 65 20 70 72 6f 76 69 64 65 73 20 62 6f 74 68 20  e provides both 
0de0: 65 6e 63 72 79 70 74 69 6f 6e 20 61 6e 64 20 73  encryption and s
0df0: 74 72 6f 6e 67 20 61 75 74 68 65 6e 74 69 63 61  trong authentica
0e00: 74 69 6f 6e 2c 0a 20 20 77 68 69 63 68 20 64 6f  tion,.  which do
0e10: 65 73 20 6e 6f 74 20 64 65 70 65 6e 64 20 6f 6e  es not depend on
0e20: 20 74 68 65 20 65 6e 63 72 79 70 74 69 6f 6e 2e   the encryption.
0e30: 20 20 54 68 65 20 63 68 65 63 6b 73 75 6d 20 69    The checksum i
0e40: 73 20 61 20 6b 65 79 65 64 20 70 6c 61 69 6e 74  s a keyed plaint
0e50: 65 78 74 0a 20 20 63 68 65 63 6b 73 75 6d 2c 20  ext.  checksum, 
0e60: 73 6f 20 69 74 20 61 63 74 75 61 6c 6c 79 20 70  so it actually p
0e70: 72 6f 74 65 63 74 73 20 74 68 65 20 70 6c 61 69  rotects the plai
0e80: 6e 20 74 65 78 74 2c 20 61 6e 64 20 70 72 6f 76  n text, and prov
0e90: 65 73 20 6b 6e 6f 77 6c 65 64 67 65 20 6f 66 0a  es knowledge of.
0ea0: 20 20 74 68 65 20 6b 65 79 20 61 74 20 74 68 65    the key at the
0eb0: 20 73 61 6d 65 20 74 69 6d 65 2e 20 20 56 65 72   same time.  Ver
0ec0: 69 66 69 63 61 74 69 6f 6e 20 6f 66 20 74 68 65  ification of the
0ed0: 20 70 61 63 6b 65 74 20 69 73 20 70 6f 73 73 69   packet is possi
0ee0: 62 6c 65 20 77 69 74 68 6f 75 74 0a 20 20 61 63  ble without.  ac
0ef0: 74 75 61 6c 6c 79 20 64 65 63 72 79 70 74 69 6e  tually decryptin
0f00: 67 20 69 74 20 28 69 2e 65 2e 20 69 74 20 5f 61  g it (i.e. it _a
0f10: 6c 73 6f 5f 20 69 73 20 61 20 63 69 70 68 65 72  lso_ is a cipher
0f20: 74 65 78 74 20 63 68 65 63 6b 73 75 6d 29 2e 20  text checksum). 
0f30: 20 53 74 72 65 6e 67 74 68 0a 20 20 69 73 20 3e   Strength.  is >
0f40: 32 35 36 20 62 69 74 73 2c 20 70 72 6f 76 69 64  256 bits, provid
0f50: 69 6e 67 20 61 20 76 65 72 79 20 68 69 67 68 20  ing a very high 
0f60: 6d 61 72 67 69 6e 2e 20 20 46 75 72 74 68 65 72  margin.  Further
0f70: 6d 6f 72 65 2c 20 4b 65 63 63 61 6b 2f 53 48 41  more, Keccak/SHA
0f80: 2d 33 20 69 73 20 61 0a 20 20 75 6e 69 76 65 72  -3 is a.  univer
0f90: 73 61 6c 20 63 72 79 70 74 6f 20 70 72 69 6d 69  sal crypto primi
0fa0: 74 69 76 65 2c 20 73 6f 20 65 76 65 72 79 74 68  tive, so everyth
0fb0: 69 6e 67 20 6e 65 65 64 65 64 20 66 6f 72 20 73  ing needed for s
0fc0: 79 6d 6d 65 74 72 69 63 20 63 72 79 70 74 6f 20  ymmetric crypto 
0fd0: 69 73 0a 20 20 64 6f 6e 65 20 77 69 74 68 20 6a  is.  done with j
0fe0: 75 73 74 20 6f 6e 65 20 70 72 69 6d 69 74 69 76  ust one primitiv
0ff0: 65 2e 20 20 4b 65 63 63 61 6b 20 77 69 6e 73 20  e.  Keccak wins 
1000: 6f 76 65 72 20 78 73 61 6c 73 61 2f 73 61 6c 73  over xsalsa/sals
1010: 61 32 30 2b 70 6f 6c 79 31 33 30 35 2e 0a        a20+poly1305..