toxygene/confusables 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

toxygene/confusables

Composer 安装命令:

composer require toxygene/confusables

包简介

This library is an implementation of the skeleton function described in the Confusion Detection section of the Unicode Security Mechanisms technical standard.

README 文档

README

This library is an implementation of the skeleton function described in the Confusion Detection section of the Unicode Security Mechanisms technical standard.

Because Unicode contains such a large number of characters and incorporates the varied writing systems of the world, incorrect usage can expose programs or systems to possible security attacks.

- http://unicode.org/reports/tr39/

Description

The skeleton function deconstructs complex Unicode graphemes into a string that can be used to detect if other strings are visually similar (aka confusable).

Usage

(Re) Building the Class File

The Confusable class file is generated by bin/build-confusables. That build script will automatically be called by composer on install/update.

The reason the class file is built dynamically is two fold:

  • The confusables.txt file is quite large (~120k). Caching them locally is an improvement, but it still requires a disk read and parsing.
  • Injecting the confusables rules into the PHP file it can be stored in PHP byte-code caches.

Should the Unicode confusables.txt file be updated, developers can rerun the build script at any time, even via a cronjob.

API

skeleton(string $a): string

Create the skeleton of a string.

Storing this value in the database will give developers a way of doing a visual uniqueness check against existing identifiers.

isConfusable(string $a, string $b): bool

Check if two strings are confusable for each other.

Under the hood, this is implemented as skeleton(A) == skeleton(B).

Warning

Casefolding is not part of the skeleton algorithm. If the requirements of your application include casefolding identifiers, it is your responsibility to supply the strings in the correct case to the skeleton function.

统计信息

  • 总下载量: 40
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-02-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固