-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
>
> Just reading it again I've just noticed that I've just written "Hash the
> bytes of $k$" - how did you decide that hashing bigints was to be done?
Oh yes, good point.
* Everything is in network byte-order, which is big-endian
> Also "Send two bytes representing the length of the bigint" - I assumed that
> this was in big-endian and length in bytes. It this right?
I'm going to go ahead and define MPI (multi-precision-integers) the way
the OpenPGP spec does:
Multi-Precision Integers (also called MPIs) are unsigned integers
used to hold large integers such as the ones used in cryptographic
calculations.
An MPI consists of two pieces: a two-octet scalar that is the length
of the MPI in bits followed by a string of octets that contain the
actual integer.
These octets form a big-endian number; a big-endian number can be
made into an MPI by prefixing it with the appropriate length.
Examples:
(all numbers are in hexadecimal)
The string of octets [00 01 01] forms an MPI with the value 1. The
string [00 09 01 FF] forms an MPI with the value of 511.
Additional rules:
The size of an MPI is ((MPI.length + 7) / 8) + 2 octets.
The length field of an MPI describes the length starting from its
most significant non-zero bit. Thus, the MPI [00 02 01] is not formed
correctly. It should be [00 01 01].
.. Thus, for the hash problem, you are hashing the same data that would
have been transmitted over a wire. In other words, construct an MPI
string as if you were about to transmit it, and hash that.
In the Java code, I'm defining a new class, MPI, that will handle all of
this correctly, including some nice utility methods. Included will be
writeMPI and readMPI, so you can use those as a reference.
Scott
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE5HXdtpXyM95IyRhURAjusAJ9VUApxGAbmvg8/L513fA4oBQO5NgCgybBr
RETauXXIAlR2Wg5PPR7a/cY=
=7wl0
-----END PGP SIGNATURE-----
_______________________________________________
Freenet-dev mailing list
Freenet-dev at lists.sourceforge.net
http://lists.sourceforge.net/mailman/listinfo/freenet-dev