Rails 大家知道 api key 的加密方式

hlcfan · March 15, 2012 · Last by clc3123 replied at March 16, 2012 · 4126 hits

经过查,我发现了http://stackoverflow.com/questions/1448455/php-api-key-generator 其中我觉得如下方式不错. Base62(MD5-HMAC(key, Normalize(referer))). This works great if the API is only allowed from one site. Just check the HMAC of the normalized referer and you know if the key is valid, no database access. You need to keep the HMAC key secret to do this.

不过不知道在 rails 里如何实现 HMAC 加密。

另外,大家有什么好的加密方式?谢谢。

查 activesupport 源码,有相关部分

$ ack hmac

You need to Sign in before reply, if you don't have an account, please Sign up first.