Reputation: 1427
When I try this:
map.put("password1", Base64.encode("111111".getBytes(),Base64.DEFAULT));
map.put("password2", Base64.encode("111111".getBytes(),Base64.DEFAULT));
map.put("password3", Base64.encode("111111".getBytes(),Base64.DEFAULT));
I got different value of password1,password2 and password3:
password1:[B@5368aecc
password2:[B@536e9ea0
password3:[B@536c0dec
Is it should be the same value? Thanks in advance.
Upvotes: 0
Views: 318
Reputation: 152817
You're essentially printing toString()
of a byte[]
array. The output is different for different byte array objects.
Either don't store the values as byte arrays by removing the .getBytes()
, or convert your byte arrays back to string with new String(byteArray, someEncoding)
.
Upvotes: 1
Reputation: 1091
Yes, its can be same , when u add a some text to your string, the old part of string is in hashed string same. Check more at Wikipedia
Upvotes: 1