Friday, April 22, 2005

On the NSA

The National Security Agency (Information Assurance Directorate) has had quite a good track record in being ahead of the curve in foreseeing crytoanalytic breaks. DES had its S-boxes strengthed against an attack unknown at the time. DES has yet to be broken, except by brute force. As DES key strength became too small, they introduced Triple-DES, also yet to be broken. Skipjack is also yet to be broken, though it was ``almost'' (N-1 rounds in X/2 work.) SHA-0 got replaced by SHA-1 before SHA-0 was broken, and SHA-2 (aka SHA-256, SHA-384, SHA-512) has been available for a while by the time SHA-1 was broken recently. One can also tell the story that they foresaw the MD4 and MD5 breaks and the SHA series were a response.

What of the future? I think they currently recommend AES-256 for Top Secret communications, and elliptic curve cryptography for crytographic signing. Are there breaks for AES-128, AES-192, RSA, and regular DH on the horizon?

Mozilla popup location bars, menu bars, etc.

Go to about:config and edit dom.* to prevent popup windows from hiding the menu bar, scroll bar, location bar, etc.

FFT

Power Spectrum of some synthetic hash table performance stuff

Wednesday, April 20, 2005

Two MD5 Challenges

Find a preimage to the all-zeros checksum. Find a second preimage that has the same checksum as the zero-byte string.

--

Mobile Email from a Cingular Wireless Customer http://www.cingular.com

Tuesday, April 19, 2005

encrypt one bit

How many bits does it take to transmit one bit, authenticated, with secret-key encryption?

ld relocation error R_SPARC_DISP32 gcj

If you forget --disable-multilib in a solaris compile of gcc, this is what happens (during java)

/bin/sh ./libtool --tag=GCJ --mode=link /BUILD/gcc/gcj -B/BUILD/sparc-sun-solaris2.9/sparcv9/libjava/ -B/BUILD/gcc/ -L/BUILD/sparc-sun-solaris2.9/sparcv9/libjava -g -O2 -m64 -m64 -o jv-convert --main=gnu.gcj.convert.Convert -rpath /INSTALL/lib/sparcv9 -shared-libgcc -L/BUILD/sparc-sun-solaris2.9/sparcv9/libjava/.libs libgcj.la

/BUILD/gcc/gcj -B/BUILD/sparc-sun-solaris2.9/sparcv9/libjava/ -B/BUILD/gcc/ -g -O2 -m64 -m64 -o jv-convert --main=gnu.gcj.convert.Convert -shared-libgcc -L/BUILD/sparc-sun-solaris2.9/sparcv9/libjava -L/BUILD/sparc-sun-solaris2.9/sparcv9/libjava/.libs ./.libs/libgcj.a -L/BUILD/sparc-sun-solaris2.9/sparcv9/libstdc++-v3/src -L/BUILD/sparc-sun-solaris2.9/sparcv9/libstdc++-v3/src/.libs -lpthread -lrt -ldl -L/BUILD/gcc/sparcv9 -L/BUILD/gcc -L/usr/ccs/bin/sparcv9 -L/usr/ccs/bin -L/usr/ccs/lib/sparcv9 -L/usr/ccs/lib -L/lib/sparcv9 -L/usr/lib/sparcv9 -lgcc -lgcc -Wl,-R -Wl,/INSTALL/lib/sparcv9

ld: fatal: relocation error: R_SPARC_DISP32: file ./.libs/libgcj.a(prims.o): symbol : offset 0xffffffff722fbc71 is non-aligned

ld: fatal: relocation error: R_SPARC_DISP32: file ./.libs/libgcj.a(prims.o): symbol : offset 0xffffffff722fbc91 is non-aligned

ld: fatal: relocation error: R_SPARC_DISP32: file ./.libs/libgcj.a(jni.o): symbol : offset 0xffffffff722fbeb9 is non-aligned

...etc.

I am using the patched binutils 2.15 as described in http://gcc.gnu.org/install/specific.html in the *-*-solaris2* section. The --disable-multilib flag is in that document, too.

Blog Template CSS changes

--- Ken's blog.html	2005-04-10 13:43:05.000000000 -0400
+++ j.html	2005-04-10 13:41:46.000000000 -0400
@@ -94,17 +94,17 @@
 /* Content
 ----------------------------------------------- */
 #content {
-  width:660px;
   margin:0 auto;
   padding:0;
   text-align:left;
   }
 #main {
-  width:410px;
+  width:70%;
   float:left;
+  margin-left: 2em;
   }
 #sidebar {
-  width:220px;
+  width:20%;
   float:right;
   }

BitTorrent Poisoning Attack

Suppose an adversary with 10,000 to 100,000 machines wanted to poison a BitTorrent torrent with bogus files (spoofed files). Because BitTorrent has hashed pieces (the hashes stored in the metainfo file), this would be an attack of bogus pieces (spoofed pieces). A hacked node would advertise (to the tracker) that it has a piece but distribute bogus pieces.

To combat such an attack we would want to know quickly whether a piece was bogus, quicker than downloading the entire piece and checking the hash. Typically a BitTorrent piece is 256 KiB. For a 640MB CD-image, there 2,500 256KiB pieces, each with a 20 byte SHA-1 checksum for a torrent metainfo file of about 50 KiB.

Ideally, we want hashes at a much finer resolution, but that makes the metainfo file a lot larger. The key idea is to distribute the high-resolution file of hashes itself through BitTorrent, and do so recursively. This is very roughly the idea of Merkle Hash Trees to be part of the BitTorrent 2 (BT2) protocol.

Assume a 1 GiB file. If each 6,464-byte is hashed with a 64 byte SHA-512 (SHA2) checksum, there's 9,900,990 bytes of first-level overhead. To transfer this 9.9 MiB of hashes, we use the BitTorrent (still under attack from the spoofing adversary) we hash each 6,464 byte chunk with SHA-512 for an additional 98,029 bytes of second-level overhead. Recursing again, the third-level file of hashes is 970 bytes. The sum of the infinite series is 10 MiB, or 1% of the original 1 GiB file. The chunk size 6,464 was chosen for one-percent overhead; obviously tweakable for different overheads and checksum widths.

For downloading, the metainfo file need only contain the ``root'' checksum, and first the client would download the depth-1 portion of the hash tree. This should be easy because it's the first thing everyone downloads, so there should be lots of copies. Then using the hashes of the depth-1 level, download the next level, eventually working to the leaves which contain the actual data, in 6,464 byte chunks.

We assume no propagation of information of what peers are bad, because that is a hard problem. (Who do you trust?)

One assumes it is worth it to waste 6,464 bytes of download to mark that a particular peer (an IP / port tuple?) is bad. With 100,000 bad nodes however, that's up to 646,400,000 bytes of wasted communication. Furthermore, during the time it takes to test all those bad nodes, the adversary can change IP addresses. Ugh.

Probabilistically, though, assume the adversary only has resources to create a 100:1 bad-node to good-node ratio (this is still a tremendous number of nodes for popular files which my have hundreds or thousands of real downloaders, i.e., good nodes). Assuming a swarm size of 20, we need to ask 2,000 machines to find 20 good nodes, so wasted communication of 1980*6464=12.8 MiB of wasted communication.

Tuesday, April 12, 2005

Complementing IUPAC Nucleotide codes

y/[ABCDGHKMNRSTVWY]/[TVGHCDMKNYSABWR]/

Saturday, April 09, 2005

Emacs Mule

from Emacs help:

C-x RET f runs the command set-buffer-file-coding-system which is an interactive compiled Lisp function in `international/mule'. (set-buffer-file-coding-system CODING-SYSTEM &optional FORCE)

Set the file coding-system of the current buffer to CODING-SYSTEM. This means that when you save the buffer, it will be converted according to CODING-SYSTEM. For a list of possible values of CODING-SYSTEM, use M-x list-coding-systems.

If the buffer's previous file coding-system value specifies end-of-line conversion, and CODING-SYSTEM does not specify one, CODING-SYSTEM is merged with the already-specified end-of-line conversion.

If the buffer's previous file coding-system value specifies text conversion, and CODING-SYSTEM does not specify one, CODING-SYSTEM is merged with the already-specified text conversion.

However, if the optional prefix argument FORCE is non-nil, then CODING-SYSTEM is used exactly as specified.

This marks the buffer modified so that the succeeding C-x C-s surely saves the buffer with CODING-SYSTEM. From a program, if you don't want to mark the buffer modified, just set the variable `buffer-file-coding-system' directly.

from C-x RET C-h

Global Bindings Starting With C-x RET:
key             binding
---             -------

C-x RET l       set-language-environment
C-x RET c       universal-coding-system-argument
C-x RET C-\     set-input-method
C-x RET X       set-next-selection-coding-system
C-x RET x       set-selection-coding-system
C-x RET p       set-buffer-process-coding-system
C-x RET k       set-keyboard-coding-system
C-x RET t       set-terminal-coding-system
C-x RET f       set-buffer-file-coding-system

Monday, April 04, 2005