mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +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() {
|
||||
int codeBytes = (int) Math.ceil(CODE_BITS / 8.0);
|
||||
int codeBytes = (CODE_BITS + 7) / 8;
|
||||
byte[] random = new byte[codeBytes];
|
||||
secureRandom.nextBytes(random);
|
||||
return ByteUtils.readUint(random, CODE_BITS);
|
||||
|
||||
Reference in New Issue
Block a user