Package org.matrix.android.sdk.internal.crypto.verification

Functions

Link copied to clipboard
fun VerificationRequest.dbgString(): String
Link copied to clipboard
fun ByteArray.getDecimalCodeRepresentation(separator: String = " "): String

decimal: generate five bytes by using HKDF. Take the first 13 bits and convert it to a decimal number (which will be a number between 0 and 8191 inclusive), and add 1000 (resulting in a number between 1000 and 9191 inclusive). Do the same with the second 13 bits, and the third 13 bits, giving three 4-digit numbers. In other words, if the five bytes are B0, B1, B2, B3, and B4, then the first number is (B0 << 5 | B1 3) + 1000, the second number is ((B1 & 0x7) << 10 | B2 << 2 | B3 6) + 1000, and the third number is ((B3 & 0x3f) << 7 | B4 1) + 1000. (This method of converting 13 bits at a time is used to avoid requiring 32-bit clients to do big-number arithmetic, and adding 1000 to the number avoids having clients to worry about properly zero-padding the number when displaying to the user.) The three 4-digit numbers are displayed to the user either with dashes (or another appropriate separator) separating the three numbers, or with the three numbers on separate lines.

Link copied to clipboard

emoji: generate six bytes by using HKDF. Split the first 42 bits into 7 groups of 6 bits, as one would do when creating a base64 encoding. For each group of 6 bits, look up the emoji from Appendix A corresponding to that number 7 emoji are selected from a list of 64 emoji (see Appendix A)