Back to project page PasswordDroid.
The source code is released under:
GNU General Public License
If you think the Android project PasswordDroid listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package de.wuthoehle.passworddroid.service.model.entries; //w w w . j a v a 2 s.c o m /* Copyright (c) 2015 Marco Huenseler <marcoh.huenseler+git@gmail.com> * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.List; import de.wuthoehle.passworddroid.crypto.Util; public class SaltVisitor implements EntryVisitor { public static final int POSITION_NAME = 0; public static final int POSITION_USER = 1; public static final int POSITION_COUNTER = 2; public static final int POSITION_SALTS = 3; private List<String> salts_list; public SaltVisitor() { this.salts_list = new ArrayList<>(); } public byte[] getSalts() throws UnsupportedEncodingException { return Util.byteListToArray( Util.stringListToUtf8ByteList( this.salts_list )); } @Override public void visit(Countable countable) { this.salts_list.add(Integer.toString(countable.getCounter())); } @Override public void visit(Customizable customizable) { // Custom parameters don't add to the salt } @Override public void visit(Commentable commentable) { // Comment doesn't add to the salt } @Override public void visit(Saltable saltable) { this.salts_list.addAll(saltable); } @Override public void visit(Entry entry) { this.salts_list.add(entry.getName()); this.salts_list.add(entry.getUser()); } }