DEV Community

Cover image for Encryption - Decryption in BrightScript / Roku
Parry Patel
Parry Patel

Posted on • Edited on

Encryption - Decryption in BrightScript / Roku

In this article, we will see how can perform Encrypt and Decrypt a string using the ToBase64String() and ToAsciiString() functions available in BrightScript respectively.

Encryption

ba = CreateObject("roByteArray")
ba.FromAsciiString("123456")
encryptedString = ba.ToBase64String()
Enter fullscreen mode Exit fullscreen mode

Decryption

ba = CreateObject("roByteArray")
ba.FromBase64String(encryptedString)
encryptedString = ba.ToAsciiString()
Enter fullscreen mode Exit fullscreen mode

Top comments (0)