Announcement Announcement Module
No announcement yet.
Sha-256 not correct? what format is required for login? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Sha-256 not correct? what format is required for login?

    hey guys i've had this issue for a while but i'm coming closer to solving the issue.

    what i m trying to do is i am trying to convert a string to sha-256 which i can do but the string that my java code is not the same as what i get from linux

    echo adam | sha256sum
    sum: f3fd8f664c016fec4372773c6b6ac06d0789857297b2473bcd 33fba523dad5fc

    MessageDigest md = MessageDigest.getInstance("SHA-256");
    	byte[] hash = md.digest(consumer.getConsumerPassword().getBytes());
    	StringBuffer sb = new StringBuffer();
    	for(byte b : hash) {
    	    sb.append(String.format("%02x", b));
    sum: f7f376a1fcd0d0e11a10ed1b6577c99784d3a6bbe669b1d13f ae43eb64634f6e

    the two sum's are similar but i don't understand why???

    also what should spring security be expecting as far as format for sha-256 if i have this in the spring security file?
    	<authentication-manager alias="authenticationManager">
    		<!-- DAO Based Security -->
    			<password-encoder hash="sha-256" />
    			<jdbc-user-service data-source-ref="dataSource"
    				users-by-username-query="SELECT A.username AS username, A.password AS password, A.enabled AS enabled FROM admin A where A.username=?"
    				authorities-by-username-query="SELECT A.username as username, A.password as password, as authority FROM admin A left join admin_roles AR on left join roles R on AR.roles = WHERE A.username=?" />
    Last edited by adam2510; Nov 8th, 2011, 12:51 AM.