11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/cloudrail_si/servicecode/commands/hash/md5.rb', line 11
def execute(environment, parameters)
Helper.assert(parameters.length == 2 &&
Helper.is_var_address(parameters[0]))
result_var = parameters[0]
message = Helper.resolve(environment, parameters[1])
Helper.assert(Helper.is_string(message))
buf = Digest::MD5.hexdigest(message)
number_array = []
(0..buf.length - 1).step(2).each do |i|
number_array.push(buf[i, 2].to_i(16))
end
environment.set_variable(result_var, number_array)
end
|