bytearray - byte array to string in java -


securerandom random = securerandom.getinstance("sha1prng"); byte[] salt = new byte[16]; random.nextbytes(salt); 

i convert salt string store/read. don't seem able work. have read need use right encoding i'm not sure encoding use. have tried following junk:

string s = new string(salt, "utf-8"); string s = new string(salt, "utf-16"); string s = new string(salt); 

edit: context, i'm trying work through , understand this code. i'm trying view salt , password can monkey code.

you need use base64 (apache commons) class or sun.misc.base64encoder/base64decode encode byte array.


Comments

Popular posts from this blog

JQuery Autocomplete without using label, value, id -

c++ - Accessing inactive union member and undefined behavior? -

JAVA - what is the difference between void and boolean methods? -