Page 1 of 1
base64 string encoder/decoder
Posted: 24 Apr 2019 13:12
by elektroinside
Hi Martin,
Is is possible to add such a function to Automagic?
Thanks
Re: base64 string encoder/decoder
Posted: 24 Apr 2019 15:01
by elektroinside
With padding would be great
Re: base64 string encoder/decoder
Posted: 24 Apr 2019 17:00
by anuraag
Its possible using java function
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"))
Re: base64 string encoder/decoder
Posted: 24 Apr 2019 17:11
by elektroinside
Wow, it works perfectly!
Many thanks!
Re: base64 string encoder/decoder
Posted: 24 Apr 2019 17:44
by Desmanto
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
Re: base64 string encoder/decoder
Posted: 25 Apr 2019 05:20
by elektroinside
"Ninja'd", haha