brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alasdairhodge <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Tweak PasswordHasher to avoid pot...
Date Thu, 11 Jun 2015 13:22:20 GMT
Github user alasdairhodge commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/687#discussion_r32219001
  
    --- Diff: usage/rest-server/src/main/java/brooklyn/rest/security/PasswordHasher.java ---
    @@ -24,8 +24,9 @@
     
     public class PasswordHasher {
         public static String sha256(String salt, String password) {
    -        byte[] salted = Charsets.UTF_8.encode((salt == null ? "" : salt) + password).array();
    -        HashCode hash = Hashing.sha256().hashBytes(salted);
    +        if (salt == null) salt = "";
    +        byte[] bytes = (salt + password).getBytes(Charsets.UTF_8);
    --- End diff --
    
    Throwing would seem appropriate, or defaulting to the empty string, as is done for the
salt. Perverse usage, but should at least be consistent.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message