I have tried :
val md = java.security.MessageDigest.getInstance("SHA-1")
val result = new sun.misc.BASE64Encoder().encode(md.digest("user:pass".getBytes))
RESULT:
md: java.security.MessageDigest = SHA-1 Message Digest from SUN, <initialized>
result: String = smGaoVKd/cQkjm7b88GyorAUz20=
I also tried :
import java.net.URLEncoder
val result = URLEncoder.encode(user + ":" + pass, "UTF-8")
RESULT:
result: String = user%3Apass
Based on http://www.base64encode.org/ The value I am wanting for result should be "dXNlcjpwYXNz"
What is the site doing differently from these encodings? Also, how might I mimic the site in Java/Scala?
Note, the specific application is for a header using Basic Authentication.