New str2saltedsha512 function for OS X Passwords#27
Merged
jeffmccune merged 1 commit intopuppetlabs:masterfrom Jan 9, 2012
Merged
New str2saltedsha512 function for OS X Passwords#27jeffmccune merged 1 commit intopuppetlabs:masterfrom
jeffmccune merged 1 commit intopuppetlabs:masterfrom
Conversation
OS X 10.7 introduced salted-SHA512 password hashes as opposed to the older LANMAN + SHA1 hashes. To assist in generating properly-formatted password hashes, this commit adds the str2saltedsha512() function which accepts a single string argument (the password) and returns a salted-SHA512 password hash which can be fed as the password attribute of a user resource in OS X 10.7. Spec tests are also added to ensure that functionality isn't broken with future commits.
Contributor
There was a problem hiding this comment.
I don't think it's a good idea to use is_a?(String) here. We might pass in something that's a kind of String like object but isn't a String itself.
It'll probably be more dynamic if we just use the object's to_s method to convert it to a string representation, whatever the heck it is.
The spec tests should then cover our expectations about how different input objects behave.
Contributor
There was a problem hiding this comment.
Actually, on second thought the explicit catching of the String is probably a better UX if the user accidentally passes in a Hash or Array.
jeffmccune
pushed a commit
that referenced
this pull request
Jan 9, 2012
New str2saltedsha512 function for OS X Passwords
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OS X 10.7 introduced salted-SHA512 password hashes as opposed to the
older LANMAN + SHA1 hashes. To assist in generating properly-formatted
password hashes, this commit adds the str2saltedsha512() function which
accepts a single string argument (the password) and returns a
salted-SHA512 password hash which can be fed as the password attribute
of a user resource in OS X 10.7.
Spec tests are also added to ensure that functionality isn't broken with
future commits.