Make generated PreKeyIds exclude both 0 and Medium.MAX_VALUE.

This commit is contained in:
Moxie Marlinspike 2014-08-04 16:31:19 -07:00
parent 006c9aae7b
commit 2db44a1578

View File

@ -71,8 +71,10 @@ public class KeyHelper {
public static List<PreKeyRecord> generatePreKeys(int start, int count) {
List<PreKeyRecord> results = new LinkedList<>();
start--;
for (int i=0;i<count;i++) {
results.add(new PreKeyRecord((start + i) % Medium.MAX_VALUE, Curve.generateKeyPair()));
results.add(new PreKeyRecord(((start + i) % (Medium.MAX_VALUE-1)) + 1, Curve.generateKeyPair()));
}
return results;