hashids2
Hashids는 숫자에서 유튜브와 비슷한 ID를 생성하는 가벼운 라이브러리입니다. 데이터베이스 ID를 사용자에게 노출하고 싶지 않을 때 Hashids를 사용하세요.
하나 또는 여러 숫자에서 YouTube 스타일의 해시를 생성하는 작은 Dart 클래스입니다. https://hashids.org 참조
>=1.16.5 <2.0.0^0.5.0아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
Build Status Coverage Status pub package
A Dart class to generate YouTube-like hashes from one or many numbers.
Ported from javascript hashids.js by Ivan Akimov
Hashids (Hash ID's) creates short, unique, decryptable hashes from unsigned (long) integers.
This algorithm tries to satisfy the following requirements:
Instead of showing items as 1, 2, or 3, you could show them as U6dc, u87U, and HMou.
You don't have to store these hashes in the database, but can encrypt + decrypt on the fly.
All (long) integers need to be greater than or equal to zero.
Follow instructions from Pub.
final hashids = HashIds();
final fromNumber = hashids.encode(42);
final fromList = hashids.encode([1,2,3]);
final fromString = hashids.encode('42');
final hashids = HashIds();
final number = hashids.decode(fromNumber); // [42]
final list = hashids.decode(fromList); // [1,2,3]
final string = hashids.decode(fromString); // [42]
MIT License. See the LICENSE file. You can use Hashids in open source projects and commercial products. Don't break the Internet. Kthxbye.