Update stdlib and concat to 6.1.0 both
[mirror/dsa-puppet.git] / 3rdparty / modules / stdlib / lib / puppet / parser / functions / str2saltedsha512.rb
index 0410c62..8b1c2c9 100644 (file)
@@ -2,15 +2,20 @@
 #  str2saltedsha512.rb
 #  Please note: This function is an implementation of a Ruby class and as such may not be entirely UTF8 compatible. To ensure compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
 #
-
 module Puppet::Parser::Functions
-  newfunction(:str2saltedsha512, :type => :rvalue, :doc => <<-EOS
-This converts a string to a salted-SHA512 password hash (which is used for
-OS X versions >= 10.7). Given any simple string, you will get a hex version
-of a salted-SHA512 password hash that can be inserted into your Puppet
-manifests as a valid password attribute.
-    EOS
-  ) do |arguments|
+  newfunction(:str2saltedsha512, :type => :rvalue, :doc => <<-DOC
+    @summary
+      This converts a string to a salted-SHA512 password hash (which is used for
+      OS X versions >= 10.7).
+
+    @return
+      converted string as a hex version of a salted-SHA512 password hash
+
+    Given any simple string, you will get a hex version
+    of a salted-SHA512 password hash that can be inserted into your Puppet
+    manifests as a valid password attribute.
+    DOC
+             ) do |arguments|
     require 'digest/sha2'
 
     raise(Puppet::ParseError, "str2saltedsha512(): Wrong number of arguments passed (#{arguments.size} but we require 1)") if arguments.size != 1
@@ -22,7 +27,7 @@ manifests as a valid password attribute.
     end
 
     seedint    = rand(2**31 - 1)
-    seedstring = Array(seedint).pack("L")
+    seedstring = Array(seedint).pack('L')
     saltedpass = Digest::SHA512.digest(seedstring + password)
     (seedstring + saltedpass).unpack('H*')[0]
   end