yihong0618 和朋友们的频道 头像

消息来源频道

yihong0618 和朋友们的频道

@hyi0618

频道8,612 位成员公开可见0 人在线

yihong0618 和朋友们的频道

成员规模8,612 位成员
在线情况0 人在线
消息总数10,129 条消息
浏览量总数3,286,989 次浏览

在这个频道里搜索消息……

t.me/hyi0618

TIL:
Link: https://github.com/thoughtbot/til/blob/main/security/constant-time-comparison.md
📌 Constant time comparison
Using == to compare sensitive hashes leaves you vulnerable to timing attacks.
This is because == returns false as soon as it finds two characters that
don't match. An attacker can make many requests with different values and
compare times to figure out how many characters were correct (the shorter the
response, the fewer correct characters).
The solution to this problem is to use a constant-time comparison algorithm.
This ensures that the method will always take the same amount of time,
regardless of how similar the hashes are. In Ruby, you can use
or
.
For more information, check out this excellent .
🔗Rack::Utils.secure_compare
🔗ActiveSupport::SecurityUtils.secure_compare
🔗blog post