Groovy web console

subscribe to the feed Subscribe
to this
site

Calculate MD5 And SHA Hash Values

Published 2 weeks ago by Anonymous with tags MD5
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def value = '6fcdb849-457c-40e6-a158-339e107e27b8:547fc9b4-1003-44f6-91a6-79d7d4a3dacd:f746d245-8e1f-4adb-bece-e87498ab4bfa' 
def md5 = value.md5()
 
def md2 = value.digest('MD2')
def sha1 = value.digest('SHA-1')
def sha256 = value.digest('SHA-256')
 
println md5 
println md2
println sha1
println sha256

println md5.size() 
println md2.size() 
println sha1.size() 
println sha256.size() 

println md5 == 'f8ab9374d8ef7f5079899fbf19f0f648'
println md2 == '4674c7e3ffa3d942117b63283b5a9b9f'
println sha1 == '12e5f6bc66e31df7177a45dc3d5b5ba77acd7970'
println sha256 == '29821ffc7f3989b3abc19a8fd6d6f72b343c0ffafcb2ac1f092e657649cec685'