#android.util.base64

1 messages · Page 1 of 1 (latest)

hollow phoenix
#

I want to do.

——————————————————
import android.until.base64;
…….
Base64.encodeToString(data,11)
——————————————————
Reenact this in java.util.base64 package

quartz treeBOT
#

This post has been reserved for your question.

Hey @hollow phoenix! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

hollow phoenix
#

simple

deft panther
#

Base64.getEncoder().encodeToString(data)

hollow phoenix
#

Thank you

quartz treeBOT
# hollow phoenix Thank you

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

hollow phoenix
#

But

#

It returns like a below
zRgubrGYn1Z3KbFZyZfx3H2Y7tCWu4wzL+rVCdn4Uvrmvnuwymj2MNKizFtrq9SUTuHm72kuw/iy8XM9MtXtYg

#

I want like a below
aadC5-YKQ6I3ojKtAaMejyKsnZkZx5FqzKHYuHaLAkQ

deft panther
#

it Base64 encodes the data

#

if you want a different Base64 string, you need different data

deft panther
hollow phoenix
#

oh

#

so

#

i send all code

deft panther
#

with ==s at the end

hollow phoenix
#

i want

wn.c.d(wn.c.f30135a, null, 0, 3, null)

in Main.java

#

(Constants.SHA256 = "SHA-256";)

deft panther
#

I have no idea what you are talking about

hollow phoenix
#

android.util.Base64.encodeToString(data, 11)

#

i want flag

#

worthy of java.util.Base64.getEncoder().encodeToString(data)

deft panther
#

?

#

What does the 11 even do?

#

What are these flags supposed to change?

hollow phoenix
#

11 means
NO_PADDING, which has value 1
NO_WRAP which has value 2 and
URL_SAFE which has value 8.

#

i want to NO_PADDING,NO_WRAP,URL_SAFE base64 encode in
java.util.base64

deft panther
#

these flags don't exist there and these things are not really specific to Base64

#

For URL_SAFE, you can use String#replace

hollow phoenix
#

ohh

#

what to replace shoud i?

deft panther
#

.replace("+","-").replace("/","_")

#

probably like that

hollow phoenix
#

ok

#

thankyou

quartz treeBOT
# hollow phoenix thankyou

If you are finished with your post, please close it.
If you are not, please ignore this message.
Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.

deft panther
#

Then I think you already figured out the NO_PADDING

#

and for NO_WRAP, you can probably just remove all line breaks