- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Why is char[] preferred over String for storing passwords?
Yes, Storing password in String object is not safe for following reasons −
String objects are immutable and until garbage collected, they remain in memory.
String being plain text can be tracked in memory dump of the application.
In log, String based password may be printed which can cause a problem.
Char[] can be cleared or wiped out after the job is done.
- Related Articles
- Explain why, plastic containers are preferred for storing food.
- Why is IPv6 preferred over IPv4?
- Why is gold jewellery more preferred over silver jewellery?
- Why is a Dictionary preferred over a Hashtable in C#?
- What is Java Server Pages, JSP? Why JSP is preferred over CGI?
- Why is cow milk preferred over Buffalo milk by most fitness freaks?
- Why are compact fluorescent lamps $(CFLs)$ preferred over electric bulbs?
- Why are convex mirror preferred over plane mirrors as rear view mirrors?
- Explain why plastic containers are favoured for storing food.
- Why Char[] array is more secure (store sensitive data) than String in Java?
- Why Nichrome is chosen over Tungsten for the heating element?
- Why did Facebook recently buy passwords off Black market?
- What is the preferred way to concatenate a string in Python?
- Why baskets made of jute are preferred most?
- When can a double-type be preferred over float-type in Java?

Advertisements