Hi Martin,
Is is possible to add such a function to Automagic?
Thanks
base64 string encoder/decoder
Moderator: Martin
-
- Posts: 69
- Joined: 14 Feb 2019 15:04
Re: base64 string encoder/decoder
With padding would be great
Re: base64 string encoder/decoder
Its possible using java function
define string variable.
replace DEFAULT with other option available here like NO_PADDING, NO_WRAP
define string variable.
replace DEFAULT with other option available here like NO_PADDING, NO_WRAP
//decode base64
decode=callJavaConstructor("java.lang.String", "String(byte[])", callJavaStaticMethod("android.util.Base64", "decode(java.lang.String, int)", string, getJavaStaticField("android.util.Base64", "DEFAULT")));
//encode to base64
encode=callJavaStaticMethod("android.util.Base64", "encodeToString(byte[], int)", callJavaMethod(string, "java.lang.String", "getBytes()"), getJavaStaticField("android.util.Base64", "DEFAULT"))
-
- Posts: 69
- Joined: 14 Feb 2019 15:04
Re: base64 string encoder/decoder
Wow, it works perfectly!
Many thanks!
Many thanks!
Re: base64 string encoder/decoder
Just about to answer this, and has been ninja'd by anuraag
But still +1 fo the encoding. Much easier to have built-in function for this.
If possible expand it to hex dec oct bin conversion too : viewtopic.php?f=5&t=7089
But still +1 fo the encoding. Much easier to have built-in function for this.
If possible expand it to hex dec oct bin conversion too : viewtopic.php?f=5&t=7089
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.
-
- Posts: 69
- Joined: 14 Feb 2019 15:04
Re: base64 string encoder/decoder
"Ninja'd", haha