diff --git a/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java b/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java index 89b2d3dbca704586a61dd0ce0d85170d1935ec20..53507da122fdfa94bdec8d11ff52ace9548ac634 100644 --- a/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java +++ b/briar-core/src/org/briarproject/crypto/CryptoComponentImpl.java @@ -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);