1
2
3
4
5
6
7
8
9
10
11
12
require 'digest/md5'

image_link = "http://img236.imageshack.us/img236/3432/as8132329zz9.png"
file_name_start = image_link.rindex("/") + 1
ext_start = image_link.rindex(".")
file_name = image_link[file_name_start, ext_start - file_name_start]
salt = "ta onomata"

digest = Digest::MD5.hexdigest(file_name + salt)
hash = digest[0, 10]

puts image_link[0, ext_start] + "." + hash +  ".xml"