Here is a couple of demo short scripts for generating and applying deltas between two rpms. The key step is to use the minigzip program from the zlib source (see the docs directory of the zlib-devel package), as minigzip uses compression compatible with the compression rpm uses. If I was writing this properly, I would consider using python, which seems to have a zlib modules, and could also hook into some rpm libraries.
Michael Young