Quantcast
Channel: Why is char[] preferred over String for passwords? - Stack Overflow
Viewing all articles
Browse latest Browse all 20

Answer by alephx for Why is char[] preferred over String for passwords?

$
0
0

Character arrays (char[]) can be cleared after use by setting each character to zero and Strings not. If someone can somehow see the memory image, they can see a password in plain text if Strings are used, but if char[] is used, after purging data with 0's, the password is secure.


Viewing all articles
Browse latest Browse all 20

Trending Articles