Ruby on rails API sha1哈希生成不匹配

Ruby on rails API sha1哈希生成不匹配,ruby-on-rails,ruby,api,hash,sha1,Ruby On Rails,Ruby,Api,Hash,Sha1,我从Slideshare API资源管理器获得的信息正在运行: 64f43b4be73bc11a15142c1ef5dab1130c5064cb 从SHA1散列以下字符串 81LqkNkvy1391428643 但当我在Rails中使用时: Digest::SHA1.hexdigest("81LqkNkvy1391428643") 我得到: 1ef520bb53227b9edf691d47da653f93d232e16e 我不明白这为什么不匹配 根据SlideShareAPI链接 它清

我从Slideshare API资源管理器获得的信息正在运行:

64f43b4be73bc11a15142c1ef5dab1130c5064cb
从SHA1散列以下字符串

81LqkNkvy1391428643
但当我在Rails中使用时:

Digest::SHA1.hexdigest("81LqkNkvy1391428643")
我得到:

1ef520bb53227b9edf691d47da653f93d232e16e
我不明白这为什么不匹配

根据SlideShareAPI链接

它清楚地说

hash: Set this to the SHA1 hash of the concatenation of the shared secret and the 
timestamp (ts). i.e. SHA1 (sharedsecret + timestamp). The order of the terms 
in the concatenation is important.
我认为我正确地遵循了说明。我还尝试解密上面的SHA1字符串,但到目前为止运气不好


这里可能有什么问题?

以毫秒为单位尝试了时间戳?

API资源管理器中的URL参数,共享密钥设置为
81LqkNkvy

...&hash=80c887e839d79dc38248ed4cda4b6ad401f57305&ts=1391434954
在Ruby中:

sharedsecret = '81LqkNkvy'
timestamp = 1391434954

require 'digest'
Digest::SHA1.hexdigest(sharedsecret + timestamp.to_s)
#=> "80c887e839d79dc38248ed4cda4b6ad401f57305"
要获取当前时间戳,请执行以下操作:

timestamp = Time.now.to_i
#=> 1391434369

请注意,哈希值每秒都在变化。

只需将其乘以千即可。你用Time.now.to_i了吗?根据他们的文档,上面写着ts:将它设置为Unix时间戳格式的当前时间,设置为最接近的秒(?),那么我认为它不需要这些零。你确定你花了utc的时间吗?谢谢,但共享的秘密是81LqkNkvy,1391428643来自时间戳,所以我实际上在加密更新代码后连接了它,也许你的时间戳不同