The output string uses at least 3 characters per byte of input, so the output length shouldn't be bytes.size.
Furthermore, the loop shouldn't be skipping over input bytes with step 3 nor excluding the last byte.
I might submit a PR to fix this if I get the time.
https://github.com/GrapheneOS/Camera/blob/71462d8762f7f8c0217be4f09fe22bab6c7bf8a3/app/src/main/java/app/grapheneos/camera/ui/activities/MainActivity.kt#L1060-L1071
The output string uses at least 3 characters per byte of input, so the output length shouldn't be
bytes.size
. Furthermore, the loop shouldn't be skipping over input bytes withstep 3
nor excluding the last byte.I might submit a PR to fix this if I get the time.