lines 30-32: # Let a,A=KEYGEN() yield a new private-public keypair in G, where a is # the secret key and A = EXP(g,a). If additional checks are needed to # insure a valid keypair, they should be performed.
s/insure/ensure/
Should those checks be specified? In particular, you need to ensure that the low three bits of a are 0. Ah, I see you say it down at line 52-53; perhaps it should be moved up here? You also define g down at 51, but use it at 31. In addition, are a,A,g in the above para meant to be numbers or strings? You'll likely need to specify the mapping between numbers and strings (it's just little-endian bytes, as it turns out).
- Ian