summaryrefslogtreecommitdiff
path: root/lib/puppet/parser/functions/sha1.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/parser/functions/sha1.rb')
-rw-r--r--lib/puppet/parser/functions/sha1.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/sha1.rb b/lib/puppet/parser/functions/sha1.rb
new file mode 100644
index 0000000..b5aa813
--- /dev/null
+++ b/lib/puppet/parser/functions/sha1.rb
@@ -0,0 +1,9 @@
+# return the sha1 hash
+require 'digest/sha1'
+
+module Puppet::Parser::Functions
+ newfunction(:sha1, :type => :rvalue) do |args|
+ Digest::SHA1.hexdigest(args[0])
+ end
+end
+