Add documentation for the keygen algorithm