Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide password in text file

I need to save username and password in text file, in this format: username#password. Is there a way in Java to hide password characters? So, if i open that txt file password can not be read.

like image 410
johnny94 Avatar asked Dec 06 '25 18:12

johnny94


1 Answers

A txt file is a plaintext file, meaning that you can't hide its content unless you encrypt it:

Simplest way to encrypt a text file in java

Alternatively, if changing the requirements is an option, you could store a hash instead of the password:

How can I hash a password in Java?

like image 200
martriay Avatar answered Dec 08 '25 10:12

martriay



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!