Note that there are some explanatory texts on larger screens.

plurals
  1. POJava hashing passwords
    primarykey
    data
    text
    <p>I am trying to make a loop that gets passwords from an array list, hashes them, and then passes the hashed passwords back into a Person object.</p> <pre><code>import java.util.ArrayList; public class CompanyDatabase { public ArrayList&lt;Person&gt; getPeople() { ArrayList&lt;Person&gt; people = new ArrayList&lt;Person&gt;(); String[] u = {"Joe","Stan","Leo","John","Sara","Lauren"}; String[] p = {"pass4321", "asdfjkl", "genericpw", "13579", "helloworld", "companypass"}; for(int j = 0; j &lt; u.length; j++){ Person temp = new Person(u[j],p[j]); people.add(temp); } return people; } } </code></pre> <hr> <pre><code>import java.util.ArrayList; import java.util.Scanner; public class CompanyDatabaseDriver { private static Scanner scan = new Scanner( System.in ) ); public static void main(String args[]) { CompanyDatabase bcData = new CompanyDatabase(); ArrayList&lt;Person&gt; people = bcData.getPeople(); Hash_SHA hasher = new Hash_SHA(); for(int i=0;i&lt;people.size();i++){ System.out.println(people.get(i).getPassword()); } // i know i have to use a variation of // String hashString = hasher.getHash(passString); // but do not really know what to do with it } </code></pre> <p>} </p> <pre><code>public class Person { private String username; private String password; public Person(String un, String pw){ username = un; password = pw; } public void setUsername(String un){ username = un; } public void setPassword(String pw){ password = pw; } public String getUsername(){ return username; } public String getPassword(){ return password; } </code></pre> <p>}</p> <p>Currently I just have the loop printing out the plain text passwords and then ending the loop. Any help would be amazing. Thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload