I want to obfuscate(*) some passwords to hide them in Java source code.
Discovering jasypt I thought I encrypt the password text beforehand and then decrypt in the source code from the remembered seed + encrypted password. However, the encryption process does not seem to be reproducible: When generating an encrypted password text with
BasicTextEncryptor bte = new BasicTextEncryptor();
bte.setPassword("something"); // the "seed"
String ep = bte.encrypt("mypasswordtext")
I get in ep
always different encrypted passwords back every time I run it: For example Zx5RdBLxIB1sPxG7Os3/G4aqqfy59l8n
, v3-D3AZWJAybdqWac9FsjdLgMqkAS9vS
or ghsD3wZwJAwjk9ghqwFLwqwgMqkwS9vS
.
How can I make the encryption reproducible, so that I can use the seed plus encrypted string to generate the real password?
(*) I use "obfuscate", because I know that this isn't a secure way to hide a password at all, but at least it helps that people cannot spot the passwords just by glaning at the source code, while keeping it all contained in the source code file.