Created
February 16, 2020 21:34
-
-
Save lordcodes/0fa55b2ad312436b23b0d97757332599 to your computer and use it in GitHub Desktop.
Code for the article: "Protecting secrets in an Android project"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun generateKey(): ByteArray { | |
| val rawKey = buildString(5) { | |
| append(byteArrayOf(0x12, 0x27, 0x42).base64EncodedString()) | |
| append(500 + 6 / 7 * 89) | |
| append(BuildConfig.ENCRYPTION_KEY) | |
| append("pghy^%£aft") | |
| } | |
| return rawKey.toByteArray() | |
| } | |
| fun ByteArray.base64EncodedString() = Base64.encodeToString(this, Base64.NO_WRAP) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment