You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defcontains_similar(domain1, domain2):
small=min(domain1, domain2, key=len)
big=max(domain1, domain2, key=len)
foriinrange(0, len(big) -len(small)):
iflooks_similar(small, big[i:i+len(small)]):
returnTruereturnFalse# Use like thiscontains_similar('flowcrypt-security', 'f1owcrypt') ==True
Haven't tried it out, just threw that together here in this comment (so probably glaring errors all over the place). I'll look at it more tomorrow.
Note - the for loop here increments the exponent of the time complexity. I'll perform some metrics to see how slow this is on big strings to see if it's realistic for running in production (don't want to harden our homograph defense only to open up an even more severe DoS vector)
It would be interesting to have a method "contains_similar". That would also catch something like
f1owcrypt-security.com
Originally posted by @tomholub in https://github.com/FlowCrypt/flowcrypt-backend/pull/290#discussion_r582715348
The text was updated successfully, but these errors were encountered: