mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 05:09:53 +01:00
Use integer maths to convert bits to bytes.
This commit is contained in:
@@ -171,7 +171,7 @@ class CryptoComponentImpl implements CryptoComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int generateInvitationCode() {
|
public int generateInvitationCode() {
|
||||||
int codeBytes = (int) Math.ceil(CODE_BITS / 8.0);
|
int codeBytes = (CODE_BITS + 7) / 8;
|
||||||
byte[] random = new byte[codeBytes];
|
byte[] random = new byte[codeBytes];
|
||||||
secureRandom.nextBytes(random);
|
secureRandom.nextBytes(random);
|
||||||
return ByteUtils.readUint(random, CODE_BITS);
|
return ByteUtils.readUint(random, CODE_BITS);
|
||||||
|
|||||||
Reference in New Issue
Block a user