java - convert byte array to Base64 String in android -


so have user enter password signup android app.

before save password database on server want convert md5 1 way hash , save database.

messagedigest md = null;     try {         md = messagedigest.getinstance("md5");     } catch (nosuchalgorithmexception e3) {         // todo auto-generated catch block         e3.printstacktrace();     }     try {         md.update(password.getbytes("utf-8"));     } catch (unsupportedencodingexception e3) {         // todo auto-generated catch block         e3.printstacktrace();     }     byte raw[] = md.digest(); 

how convert byte array base64 string. saw in forum android util package left out base64 encoding , decoding on other hand see encodetostring function in android developers site.

any appreciated.

if want application compatible below api level 8, can pull in 3rd part library handle base64 encoding.

apache commons codec 1 can try. includes base64 codec: http://commons.apache.org/codec/api-release/index.html.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -