File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
app/src/main/java/org/vonderheidt/hips/utils Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change 11package org.vonderheidt.hips.utils
22
3- import kotlinx.coroutines.delay
4-
53/* *
64 * Object (i.e. singleton class) that represents the binary conversion of the secret message using UTF-8 encoding.
75 *
@@ -14,12 +12,8 @@ object UTF8 {
1412 * @param secretMessage Secret message.
1513 * @return Binary representation of the secret message.
1614 */
17- suspend fun encode (secretMessage : String ): ByteArray {
18- // Wait 5 seconds
19- delay(5000 )
20-
21- // Return placeholder
22- val plainBits = ByteArray (size = 0 )
15+ fun encode (secretMessage : String ): ByteArray {
16+ val plainBits = secretMessage.toByteArray(charset = Charsets .UTF_8 )
2317
2418 return plainBits
2519 }
@@ -30,13 +24,9 @@ object UTF8 {
3024 * @param plainBits Binary representation of the secret message.
3125 * @return Secret message.
3226 */
33- suspend fun decode (plainBits : ByteArray ): String {
34- // Wait 5 seconds
35- delay(5000 )
36-
37- // Return placeholder
38- val coverText = " "
27+ fun decode (plainBits : ByteArray ): String {
28+ val secretMessage = String (bytes = plainBits, charset = Charsets .UTF_8 )
3929
40- return coverText
30+ return secretMessage
4131 }
4232}
You can’t perform that action at this time.
0 commit comments