تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يتيح لك النموذج الأساسي للدالة الزائفة العشوائية (PRF) إنتاج مخرجات ثابتة، عشوائية،
ومخرجات عشوائية عشوائية لمدخل معين.
ولأنّ Tink يعمل على مجموعات مفاتيح، يعرض هذا النموذج
الأساسي مجموعة مقابلة من PRF بدلاً من واحد. تتم فهرسة PRFs بواسطة معرّف مفتاح 32 بت. يمكن استخدام هذه الأداة لتغيير المفتاح المستخدَم لإخفاء جزء من المعلومات بدون فقدان عملية الربط السابقة.
يحتوي PRF على الخصائص التالية:
محدّدة:
سينتج دائمًا حساب PRF لمدخل معيّن النتيجة نفسها.
العشوائية:
لا يمكن تمييز ناتج PRF عن وحدات البايت العشوائية.
اختيار نوع المفتاح
ننصح باستخدام HMAC_SHA256_PRF لمعظم الاستخدامات، ولكن هناك
خيارات أخرى أيضًا.
وبشكل عام، ينطبق ما يلي:
قد يكون HMAC_SHA512_PRF أسرع أو لا يكون أسرع بناءً على حجم الإدخال
وتفاصيل الأجهزة التي تستخدمها.
HMAC_SHA512_PRF هو الوضع الأكثر تحفُّظًا الذي يمكن استخدامه
لعدد غير محدود من الرسائل.
يُعد AES_CMAC_PRF الأسرع على الأنظمة التي تتوافق مع تسريع الأجهزة AES-NI.
الحد الأدنى من ضمانات الأمان
بدون معرفة المفتاح، لا يمكن تمييز PRF عن
الدالة العشوائية
توفير أمان 128 بت على الأقل، وأيضًا في سيناريوهات المستخدمين المتعددين (عندما لا يستهدف المهاجم مفتاحًا محددًا، ولكن أي مفتاح من مجموعة مفاتيح يصل عددها إلى 232)
يتوفر 16 بايت على الأقل من الناتج
أمثلة على حالات الاستخدام
تشمل حالات استخدام "إطار الشفافية والموافقة" عملية تنقيح حتمية لمعلومات تحديد الهوية الشخصية (PII) ووظائف التجزئة المرتبطة بالمفاتيح وإنشاء أرقام تعريف فرعية لا تسمح بالانضمام إلى مجموعة البيانات الأصلية بدون معرفة المفتاح.
في حين أنّه يمكن استخدام إطار عمل PRF لإثبات صحة رسالة معيّنة، يُنصَح باستخدام الإصدار الأساسي لـ MAC مع حالة الاستخدام هذه، إذ يوفّر إمكانية التحقّق وتجنُّب مشاكل الأمان التي تحدث غالبًا أثناء عملية التحقّق وتوفير دعم تلقائي لتغيير المفاتيح. كما أنه يسمح بالخوارزميات
غير الحتمية.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eTink's PRF primitive provides stable, pseudo-random outputs for given inputs, enabling deterministic redaction and keyed hashing functionalities.\u003c/p\u003e\n"],["\u003cp\u003ePRFs in Tink are indexed by key IDs within keysets, allowing for key rotation without association loss.\u003c/p\u003e\n"],["\u003cp\u003eWhile offering strong security, PRFs are deterministic and do not guarantee anonymity, only pseudonymity, requiring careful application in privacy-sensitive systems.\u003c/p\u003e\n"],["\u003cp\u003eTink supports various PRF key types, with HMAC_SHA256_PRF recommended for most use cases and AES_CMAC_PRF potentially offering the best performance on hardware with AES-NI acceleration.\u003c/p\u003e\n"],["\u003cp\u003ePRFs provide a minimum of 128-bit security, even in multi-user environments with large key sets, and can generate at least 16 bytes of output.\u003c/p\u003e\n"]]],["Pseudo-Random Function (PRF) produces stable, pseudo-random outputs for a given input, managed via keysets indexed by a 32-bit key ID for rotation. Key properties include deterministic output and randomness. `HMAC_SHA256_PRF` is recommended, with alternatives like `HMAC_SHA512_PRF` and `AES_CMAC_PRF`. PRF provides pseudonymity, not anonymity, and is secure with at least 128-bit security. Use cases include deterministic PII redaction and creating non-joinable sub-IDs. MAC is recommended for proving authenticity.\n"],null,["# Pseudo-Random Function (PRF)\n\nThe Pseudo-Random Function (PRF) primitive lets you produce stable, arbitrary\nlength, pseudo-random outputs for a given input.\n\nSince Tink operates on [keysets](/tink/design/keysets), this primitive exposes a\ncorresponding set of PRFs instead of a single PRF. The PRFs are indexed by a 32\nbit key ID. This can be used to rotate the key used to redact a piece of\ninformation, without losing the previous association.\n\nPRF has the following properties:\n\n- **Deterministic**: Computing a PRF for a given input will always produce the same output.\n- **Randomness**: The output of a PRF is indistinguishable from random bytes.\n\n| **Caution:** Since PRFs operate deterministically on their input, using a PRF to redact will *not* provide anonymity, but only provide pseudonymity. It can be an important tool to build privacy-aware systems, but has to be used carefully.\n\nChoose a key type\n-----------------\n\nWe recommend using **`HMAC_SHA256_PRF`** for most uses, but there are other\noptions as well.\n\nIn general, the following holds true:\n\n- `HMAC_SHA512_PRF` may or may not be faster depending on your input size and the specifics of the hardware you use.\n- `HMAC_SHA512_PRF` is the most conservative mode that can be used for practically unlimited number of messages.\n- `AES_CMAC_PRF` is fastest on systems that support the [AES-NI](https://www.intel.com/content/www/us/en/developer/articles/technical/advanced-encryption-standard-instructions-aes-ni.html) hardware acceleration.\n\n| **Caution:** While `HMAC_SHA256_PRF`, `HMAC_SHA512_PRF`, and `HKDF_SHA256` behave like a cryptographically secure hash function if the key is revealed, and still provide some protection against revealing the input, `AES_CMAC_PRF` is only secure as long as the key is secure.\n\nMinimal security guarantees\n---------------------------\n\n- Without knowledge of the key, the PRF is indistinguishable from a random function\n- At least 128-bit security, also in multi-user scenarios (when an attacker is not targeting a specific key, but any key from a set of up to 2^32^ keys)\n- At least 16 bytes of output available\n\nExample use cases\n-----------------\n\nUse cases for PRF include deterministic redaction of personally identifiable\ninformation (PII), keyed hash functions, and creating sub-IDs that don't allow\njoining with the original dataset without knowing the key.\n\nWhile PRFs can be used in order to prove authenticity of a message, using the\n[MAC primitive](/tink/mac) is recommended for that use case, as it has support for\nverification, avoiding the security problems that often happen during\nverification, and having automatic support for key rotation. It also allows for\nnon-deterministic algorithms."]]