1
0
Fork 0
oldhaven/lib/vkontakte.rb

16 lines
437 B
Ruby

module Vkontakte
@@secret_key = 'sdgwSbl3nNE4ZxafuPrp'
def self.check params
unless params[:expire].nil? or params[:mid].nil? or params[:secret].nil? or params[:sid].nil? or params[:sig].nil?
return true if self.sign(params) == params[:sig]
end
false
end
private
def self.sign params
Digest::MD5.hexdigest(%w(expire mid secret sid).map{ |_| _+'='+params[_.to_sym] }.join()+@@secret_key)
end
end