I am working on a project that needs to analyze whether a string can be confused with another (mainly for cybersecurity reasons).
Since I couldn’t find any existing Swift package for this, I went ahead and naively ported one which is OK for my POC.
As I need this functionality in a more robust form and believe it could be valuable to others, I am considering creating an open-source package dedicated to it. I am not an expert in Unicode, and I know this is a tricky subject, so I’m reaching out for guidance on the right direction and to gather potential requirements from people interested in such a package.
Current state:
I have read UTR #36: Unicode Security Considerations and UTS #39: Unicode Security Mechanisms
I quickly ported the following Python package to Swift : GitHub - woodgern/confusables: A python package providing functionality for matching words using different characters but appearing to be a similar/the same word.
I tried embedding all the data directly inside a Swift file to avoid parsing resource data when initializing the package, but that broke the compiler, making it requiring tens of Go of RAM (the data type is a Dictionary<Character, Set<String>>).
I’m wondering: what is the recommended practice for embedding large amounts of data in code for efficient loading?
Also, when looking at different implementations of confusables (for example, this Rust crate: confusables - Rust ), I’ve noticed that what is considered “confusable” can vary significantly.