パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v2.0.0

hashids2

Hashids は、数値から YouTube のような ID を生成するための小さなライブラリです。データベースの ID をユーザーに公開したくない場合に Hashids を使用してください。

AndroidiOSWebmacOSWindowsLinux
30日間ダウンロード
9600
いいね数
29
Pub ポイント
140

パッケージをインストール

flutter pub add hashids2

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Hashids2 は、YouTube の ID 形式に似た数値から短く、一意で URL セーフな ID を生成する軽量な Dart パッケージです。データベース ID を隠蔽し、ユーザーが連続する識別子を予測または操作できないように設計されています。セキュリティのための「見えない」戦略が有効なパブリック向けアプリに最適です。Android、iOS、Web、macOS、Windows、Linux など複数のプラットフォームをサポートしており、クロスプラットフォームアプリに非常に柔軟に対応できます。独自のソルトと長さの設定により、出力形式のユニーク性と制御を実現します。

用途

  • URL内のデータベースIDの難読化
  • 短い一意の識別子を生成する
  • IDの列挙からAPIエンドポイントを保護する
  • 使いやすい共有リンクの作成
  • 公開APIにおける連続IDの露出を防ぐ

主な機能

  • 数値から URL セーフな文字列を生成します
  • カスタマイズ可能な塩と最小長さ
  • クロスプラットフォーム互換性
  • Flutterアプリとのシンプルな統合
  • エンコーディングとデコーディングの両方をサポート

適している対象

  • 安全なID生成が必要なWebおよびモバイルアプリ
  • データベース構造を非表示にしたい開発者
  • 公開向け識別子を持つアプリケーション
  • 複雑な暗号化を必要としない単純なオブスカレーションを必要とするプロジェクト

注意事項

  • 高セキュリティな暗号化ニーズには適していません
  • 一意性を確保するためには塩の管理に注意が必要です
  • 暗号化または認証を提供しない
  • 出力の長さは、入力サイズと構成に依存します
  • IDの難読化に限定され、完全なデータ保護ではない

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Hashids2

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

What is it?

Hashids (Hash ID's) creates short, unique, decryptable hashes from unsigned (long) integers.

This algorithm tries to satisfy the following requirements:

  1. Hashes must be unique and decryptable.
  2. They should be able to contain more than one integer (so you can use them in complex or clustered systems).
  3. You should be able to specify minimum hash length.
  4. Hashes should not contain basic English curse words (since they are meant to appear in public places - like the URL).

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.

Usage

Import the package

Follow instructions from Pub.

Encrypting
final hashids = HashIds();
final fromNumber = hashids.encode(42);
final fromList = hashids.encode([1,2,3]);
final fromString = hashids.encode('42');
Decrypting
final hashids = HashIds();
final number = hashids.decode(fromNumber); // [42]
final list = hashids.decode(fromList); // [1,2,3]
final string = hashids.decode(fromString); // [42]

License

MIT License. See the LICENSE file. You can use Hashids in open source projects and commercial products. Don't break the Internet. Kthxbye.

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。