كيف تحصل على الوحدةGetting the module
ملف واحد اسمه tahsin.mjs، بلا أي اعتماديات وبلا أي طلب شبكة. استورده من الموقع مباشرة، من الرابط المثبّت على إصدار.One file, tahsin.mjs, with no dependencies and no network calls. Import it straight from the site, from the version-pinned URL.
// in your own page or module: pin the exact version
import { analyze } from 'https://tahsin-pqc.github.io/tahsin/tahsin-0.4.4.mjs';هذا الرابط مثبّت على إصدار بعينه ولن يتغير محتواه. أما tahsin.mjs فيتحرك مع كل إصدار جديد، ولهذا لا نوصي بالاستيراد منه في كود يعمل عند الآخرين: أي تغيير فيه يصل إلى موقعك فورًا بلا مراجعة منك، وإن أُفسد الملف أو استُبدل فسيعمل عندك كما هو.That URL is pinned to one version and its content will not change. tahsin.mjs moves with every release, so we do not recommend importing it in code that runs on other people's pages: any change to it reaches your site at once, with no review by you, and if the file were ever broken or replaced it would run as is.
بصمة SHA-384 للملف المثبّت (محسوبة وقت توليد هذه الصفحة):SHA-384 of the pinned file (computed when this page was generated):
sha384-9xMIBapGswTTsUSdoWe1Tkc5RwoS4WJ281xb758TizI6mXePwj9bzkMVcELBBKEBتحقق منها بنفسك، وأضف سطر التحميل المسبق مع integrity قبل استيراد الوحدة. المتصفح يرفض الملف إن لم تطابق بصمته. نكتب هذا بحذر: integrity على modulepreload تدعمه المتصفحات الحديثة، والاستيراد نفسه بلا integrity في المتصفحات الأقدم.Verify it yourself, and add a preload line with integrity before importing the module. The browser rejects the file if its hash does not match. We say this with care: integrity on modulepreload is supported by current browsers, and in older ones the import itself runs without an integrity check.
curl -s https://tahsin-pqc.github.io/tahsin/tahsin-0.4.4.mjs | openssl dgst -sha384 -binary | openssl base64 -A
<link rel="modulepreload" href="https://tahsin-pqc.github.io/tahsin/tahsin-0.4.4.mjs" integrity="sha384-9xMIBapGswTTsUSdoWe1Tkc5RwoS4WJ281xb758TizI6mXePwj9bzkMVcELBBKEB">يعمل في المتصفح كما يعمل في Node 18 أو أحدث. لا خطوة بناء ولا حزم. الملف مولَّد من src/*.js بالسكربت build-esm.js، ورقم إصداره هو رقم إصدار الحزمة، ويُعاد توليده في كل بناء ويتحقق منه الاختبار. رقم إصدار الوحدة (0.4.x) منفصل عن رقم إصدار المشروع (v1.6.x) الذي تراه في صفحة الإصدارات على GitHub: الأول يخصّ المحرّك وملفه، والثاني يخصّ الموقع كله.It runs in the browser exactly as it does in Node 18 or later. No build step, no packages. The file is generated from src/*.js by build-esm.js, its version is the package version, and CI regenerates it and checks it on every build. The module version (0.4.x) is separate from the project release (v1.6.x) on GitHub: the first versions the engine file, the second versions the whole site.
الترخيص MIT يسمح لك بنسخ الملف إلى مشروعك، لكن الاستيراد من الرابط المثبّت يبقيك على إصدار معروف ببصمة معروفة. لا ننشر على npm، ولا نطلب منك حسابًا.The MIT licence lets you copy the file into your project, but importing from the pinned URL keeps you on a known version with a known hash. There is no npm package, and no account is needed.
ما تصدّره الوحدةWhat the module exports
| الاسمExport | ما يفعلهWhat it does |
|---|---|
analyze(settings) | يحلّل مصدرًا أو أكثر ويعيد النتيجة: الأصول، الأولويات، الجهد، مؤشر الجاهزية.Analyzes one or more sources and returns the result: assets, priorities, effort, readiness indicator. |
defaults() | الافتراضات الافتراضية (Y وZ والسيناريوهات ووحدات الجهد) لتعديلها قبل التحليل.The default assumptions (Y, Z, scenarios, effort units) so you can change them before analyzing. |
reportHtml(result, lang, date) | مقطع HTML للتقرير بالعربية أو الإنجليزية، تُدخله في صفحتك.An HTML fragment of the report in Arabic or English, to drop into your own page. |
toJSON(result, date) | نص JSON: الملخص والأصول والخطة والافتراضات.A JSON string: summary, assets, plan and assumptions. |
version / engineVersion | إصدار الوحدة (0.4.x) وإصدار المحرّك وقواعد التصنيف.Module version (0.4.x), engine version and rules date. |
settings يقبل: sources (كل مصدر فيه label وtext وlife اختياري)، وY سنوات الهجرة، وZ سنوات حتى يُكسر RSA/ECC، وteam حجم الفريق، وrate تكلفة يوم العمل. تفاصيل الحقول في صفحة واجهة البرمجة.settings accepts: sources (each with label, text and an optional life), Y migration years, Z years until RSA/ECC breaks, team size and rate cost per person-day. Field details are on the API page.
مثال ١: تحليل CBOM وقراءة النتيجةExample 1: analyze a CBOM and read the result
هذا الملف هو examples/dev/analyze.mjs كما هو في المستودع، والاختبار ينفّذه فعليًا في كل بناء.This is examples/dev/analyze.mjs exactly as it is in the repository; the test suite runs it on every build.
// Example 1: analyze a CycloneDX CBOM string and read the result.
// Run it: node examples/dev/analyze.mjs
import { analyze } from '../../tahsin.mjs';
const cbom = JSON.stringify({
bomFormat: 'CycloneDX', specVersion: '1.6',
components: [
{ type: 'cryptographic-asset', name: 'RSA-2048', cryptoProperties: { assetType: 'algorithm' } },
{ type: 'cryptographic-asset', name: 'ECDH-P256', cryptoProperties: { assetType: 'algorithm' } },
{ type: 'cryptographic-asset', name: 'ML-KEM-768', cryptoProperties: { assetType: 'algorithm' } }
]
});
const result = analyze({
Y: 5, // years your migration will take
Z: 15, // years your data must stay secret
sources: [{ label: 'my-app', text: cbom, life: 10 }]
});
console.log('readiness', result.ready + '%', '(' + result.level + ')');
console.log('assets', result.list.length, 'at risk', result.counts.atRisk);
for (const asset of result.list) console.log(asset.pr, asset.text, asset.status);
مخرجات تشغيله الآن:Its output right now:
readiness 33% (medium)
assets 3 at risk 2
P2 ECDH-P256 vulnerable
P2 RSA-2048 vulnerable
M ML-KEM-768 pqc
مثال ٢: تصدير JSON للوحة تحكم أو CIExample 2: export JSON for a dashboard or CI
الملف examples/dev/json.mjs، ويُشغَّل بنفس الطريقة.The file examples/dev/json.mjs, run the same way.
// Example 2: analyze a scanner output and export machine-readable JSON
// for your own dashboard or CI job.
// Run it: node examples/dev/json.mjs
import { readFileSync, writeFileSync } from 'node:fs';
import { analyze, toJSON } from '../../tahsin.mjs';
const text = readFileSync(new URL('../../sample-scan.txt', import.meta.url), 'utf8');
const result = analyze({ sources: [{ label: 'scan', text, life: 12 }] });
const json = toJSON(result, '2026-12-01');
const data = JSON.parse(json);
writeFileSync('results.json', json);
console.log('wrote results.json', json.length, 'bytes');
console.log('progress', data.progress_percent + '%', 'risk', data.risk_level, 'assets', data.assets.length);
مثال محلول على عيّنة الأداةA worked example on the built-in sample
هذه الأرقام ليست مكتوبة بيدي: تُحسب وقت توليد هذه الصفحة بتشغيل الوحدة على sample-cbom.json الموجود في المستودع.These numbers are not typed by hand: they are computed when this page is generated, by running the module on sample-cbom.json from the repository.
| المخرَجOutput | القيمةValue |
|---|---|
| أصول فريدةUnique assets | 13 |
| بنود P0 (اليوم)P0 items (now) | 2 |
| بنود P1 (عاجل)P1 items (urgent) | 3 |
| مؤشر الجاهزيةReadiness indicator | 19% |
| مستوى الخطرRisk level | حرجcritical |
| الجهد التقديري (يوم عمل)Estimated effort (person-days) | 21 |
مؤشر الجاهزية مقياس داخلي للأداة وليس معيارًا رسميًا. وZ افتراض تضعه أنت، لا تنبؤ بموعد الحاسوب الكمّي.The readiness indicator is this tool's own internal measure, not an official standard. Z is an assumption you set, not a forecast of when a quantum computer arrives.
حدود الوحدةWhat the module does not do
- لا تتصل بالشبكة. لا تُجري فحصًا على خادم ولا تجلب شيئًا؛ تعمل على النص الذي تعطيها إياه.It never touches the network. It scans no server and fetches nothing; it works on the text you hand it.
- ليست تدقيقًا. هي مساعد تخطيط: التصنيف قائم على قواعد نصية، وما لا تعرفه يُعرض للمراجعة اليدوية بدل تخمينه.It is not an audit. It is a planning aid: classification is rule-based on text, and anything it cannot place is flagged for manual review instead of guessed.
- ليست واجهة الموقع. الوحدة تحوي المحرّك والتقارير والتصدير، ولا تحوي واجهة الصفحة ولا محاكي Shor ولا مصنّف الـ wasm.It is not the site UI. The module carries the engine, reports and exports; it does not carry the page UI, the Shor demo or the WASM classifier.
- الأرقام قابلة للتعديل. الافتراضات (Y وZ ووحدات الجهد) تخصك أنت، وتغييرها يغيّر النتيجة.The numbers are yours to set. The assumptions (Y, Z, effort units) belong to you, and changing them changes the result.
الترخيصLicence
الوحدة مفتوحة المصدر بترخيص MIT: لك أن تستخدمها وتعدّلها وتوزّعها بشرط الإبقاء على إشعار الترخيص. النص الكامل في ملف LICENSE، والتفاصيل في صفحة حقوق النشر.The module is open source under the MIT licence: you may use, modify and redistribute it as long as you keep the licence notice. The full text is in LICENSE; details on the copyright page.
الشيفرة منشورة للقراءة على github.com/tahsin-pqc/tahsin. إن وجدت خطأ في تصنيف، افتح بلاغًا مع المدخل والمخرَج المتوقع.The code is published for reading at github.com/tahsin-pqc/tahsin. If a classification is wrong, open an issue with the input and the output you expected.