Puppet Function: stdlib::sha256
- Defined in:
-
vendor_modules/stdlib/lib/puppet/functions/stdlib/sha256.rb
- Function type:
- Ruby 4.x API
Summary
Run a SHA256 calculation against a given value.
Overview
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'vendor_modules/stdlib/lib/puppet/functions/stdlib/sha256.rb', line 6
Puppet::Functions.create_function(:'stdlib::sha256') do
dispatch :sha256 do
param 'Variant[ScalarData, Sensitive[ScalarData], Binary, Sensitive[Binary]]', :my_data
return_type 'String'
end
def sha256(my_data)
Digest::SHA256.hexdigest(my_data.unwrap.to_s)
rescue
Digest::SHA256.hexdigest(my_data.to_s)
end
end
|