URLs and Hashing
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
এই বিভাগে ক্লায়েন্ট কিভাবে URL চেক করে তার বিস্তারিত বিবরণ রয়েছে।
ইউআরএলের ক্যানোনিকালাইজেশন
কোনো ইউআরএল চেক করার আগে, ক্লায়েন্ট সেই ইউআরএলে কিছু ক্যানোনিকালাইজেশন করবে বলে আশা করা হয়।
শুরু করার জন্য, আমরা ধরে নিই যে ক্লায়েন্ট URLটিকে পার্স করেছে এবং RFC 2396 অনুযায়ী এটি বৈধ করেছে৷ যদি URLটি একটি আন্তর্জাতিক ডোমেন নাম (IDN) ব্যবহার করে, তাহলে ক্লায়েন্টকে URLটিকে ASCII Punycode উপস্থাপনায় রূপান্তর করতে হবে৷ URL একটি পাথ উপাদান অন্তর্ভুক্ত করা আবশ্যক; অর্থাৎ, ডোমেন অনুসরণ করে কমপক্ষে একটি স্ল্যাশ থাকতে হবে ( http://google.com/
এর পরিবর্তে http://google.com
)।
প্রথমে, URL থেকে ট্যাব (0x09), CR (0x0d), এবং LF (0x0a) অক্ষরগুলি সরান৷ এই অক্ষরগুলির জন্য এস্কেপ সিকোয়েন্সগুলি সরিয়ে ফেলবেন না (যেমন %0a
)।
দ্বিতীয়ত, যদি URL একটি খণ্ডে শেষ হয়, তাহলে খণ্ডটি সরান। উদাহরণস্বরূপ, http://google.com/#frag
http://google.com/
এ ছোট করুন।
তৃতীয়ত, বারবার ইউআরএল-কে পার্সেন্ট-আনস্কেপ করুন যতক্ষণ না এতে আর শতাংশ-এস্কেপ না হয়। (এটি URLটিকে অবৈধ রেন্ডার করতে পারে।)
হোস্টনামটিকে ক্যানোনিকালাইজ করতে:
URL থেকে হোস্টনাম বের করুন এবং তারপর:
- সমস্ত অগ্রণী এবং পিছনের বিন্দুগুলি সরান৷
- একটি একক বিন্দু দিয়ে পরপর বিন্দু প্রতিস্থাপন করুন।
- যদি হোস্টনামটি একটি IPv4 ঠিকানা হিসাবে পার্স করা যায়, তাহলে এটিকে 4 ডট-বিভাজিত দশমিক মানগুলিতে স্বাভাবিক করুন। ক্লায়েন্টকে অক্টাল, হেক্স এবং চারটিরও কম উপাদান সহ যেকোনো আইনি আইপি-ঠিকানা এনকোডিং পরিচালনা করা উচিত।
- যদি হোস্টনামটিকে একটি বন্ধনীযুক্ত IPv6 ঠিকানা হিসাবে পার্স করা যায়, তাহলে উপাদানগুলির মধ্যে অপ্রয়োজনীয় অগ্রণী শূন্যগুলি সরিয়ে এবং ডাবল-কোলন সিনট্যাক্স ব্যবহার করে শূন্য উপাদানগুলি ভেঙে দিয়ে এটিকে স্বাভাবিক করুন। উদাহরণস্বরূপ
[2001:0db8:0000::1]
[2001:db8::1]
এ রূপান্তরিত করা উচিত। যদি হোস্টনামটি নিম্নলিখিত দুটি বিশেষ IPv6 ঠিকানা প্রকারের মধ্যে একটি হয়, তাহলে তাদের IPv4 এ রূপান্তর করুন:- একটি IPv4-ম্যাপ করা IPv6 ঠিকানা, যেমন
[::ffff:1.2.3.4]
, যা 1.2.3.4
এ রূপান্তরিত হওয়া উচিত; - একটি NAT64 ঠিকানা সুপরিচিত উপসর্গ ব্যবহার করে 64:ff9b::/96 , যেমন
[64:ff9b::1.2.3.4]
, যা 1.2.3.4
এ রূপান্তরিত হওয়া উচিত।
- পুরো স্ট্রিং ছোট হাতের অক্ষর.
পথটিকে আদর্শীকরণ করতে:
-
/./
এর সাথে /
, এবং /../
পূর্ববর্তী পাথ উপাদানের সাথে প্রতিস্থাপন করে /../
এবং /./
পাথের ক্রমগুলি সমাধান করুন৷ - একটানা স্ল্যাশের রানগুলিকে একটি একক স্ল্যাশ অক্ষর দিয়ে প্রতিস্থাপন করুন।
ক্যোয়ারী প্যারামিটারে এই পাথ ক্যানোনিকালাইজেশন প্রয়োগ করবেন না।
URL-এ, <= ASCII 32, >= 127, #
, বা %
সমস্ত অক্ষর শতাংশ-এস্কেপ করুন। এস্কেপগুলিতে বড় হাতের হেক্স অক্ষর ব্যবহার করা উচিত।
হোস্ট-প্রত্যয় পাথ-প্রিফিক্স এক্সপ্রেশন
একবার ইউআরএল ক্যানোনিকালাইজ করা হলে, পরবর্তী ধাপ হল প্রত্যয়/প্রিফিক্স এক্সপ্রেশন তৈরি করা। প্রতিটি প্রত্যয়/প্রিফিক্স এক্সপ্রেশনে একটি হোস্ট প্রত্যয় (বা সম্পূর্ণ হোস্ট) এবং একটি পাথ উপসর্গ (বা সম্পূর্ণ পথ) থাকে।
ক্লায়েন্ট 30টি পর্যন্ত বিভিন্ন সম্ভাব্য হোস্ট প্রত্যয় এবং পথ উপসর্গ সমন্বয় গঠন করবে। এই সমন্বয় শুধুমাত্র URL এর হোস্ট এবং পাথ উপাদান ব্যবহার করে। স্কিম, ব্যবহারকারীর নাম, পাসওয়ার্ড এবং পোর্ট বাতিল করা হয়েছে। যদি URL-এ ক্যোয়ারী প্যারামিটার থাকে, তাহলে অন্তত একটি সংমিশ্রণে সম্পূর্ণ পাথ এবং ক্যোয়ারী প্যারামিটার অন্তর্ভুক্ত থাকবে।
হোস্টের জন্য , ক্লায়েন্ট সর্বোচ্চ পাঁচটি ভিন্ন স্ট্রিং চেষ্টা করবে। তারা হল:
- হোস্টনামটি যদি IPv4 বা IPv6 আক্ষরিক না হয়, তাহলে eTLD+1 ডোমেন দিয়ে শুরু করে এবং পরপর লিডিং কম্পোনেন্ট যোগ করে চারটি হোস্টনাম তৈরি হয়। eTLD+1-এর নির্ধারণ পাবলিক সাফিক্স তালিকার উপর ভিত্তি করে হওয়া উচিত। উদাহরণ স্বরূপ,
abexample.com
ফলে example.com
এর eTLD+1 ডোমেইনের পাশাপাশি একটি অতিরিক্ত হোস্ট উপাদান b.example.com
সাথে হোস্ট হবে। - URL-এ সঠিক হোস্টনাম। আগের উদাহরণ অনুসরণ করে,
abexample.com
চেক করা হবে।
পথের জন্য , ক্লায়েন্ট সর্বোচ্চ ছয়টি ভিন্ন স্ট্রিং চেষ্টা করবে। তারা হল:
- ক্যোয়ারী প্যারামিটার সহ URL-এর সঠিক পথ।
- ক্যোয়ারী প্যারামিটার ছাড়াই URL-এর সঠিক পথ।
- চারটি পাথ রুট (/) থেকে শুরু করে এবং একটি ট্রেইলিং স্ল্যাশ সহ পর্যায়ক্রমে পাথ উপাদান যুক্ত করে গঠিত হয়।
নিম্নলিখিত উদাহরণগুলি চেকের আচরণকে চিত্রিত করে:
URL http://abcom/1/2.html?param=1
এর জন্য, ক্লায়েন্ট এই সম্ভাব্য স্ট্রিংগুলি চেষ্টা করবে:
a.b.com/1/2.html?param=1
a.b.com/1/2.html
a.b.com/
a.b.com/1/
b.com/1/2.html?param=1
b.com/1/2.html
b.com/
b.com/1/
URL http://abcdefcom/1.html
এর জন্য, ক্লায়েন্ট এই সম্ভাব্য স্ট্রিংগুলি চেষ্টা করবে:
a.b.c.d.e.f.com/1.html
a.b.c.d.e.f.com/
c.d.e.f.com/1.html
c.d.e.f.com/
d.e.f.com/1.html
d.e.f.com/
e.f.com/1.html
e.f.com/
f.com/1.html
f.com/
(দ্রষ্টব্য: bcdefcom
এড়িয়ে যান, যেহেতু আমরা শুধুমাত্র শেষ পাঁচটি হোস্টনামের উপাদান এবং সম্পূর্ণ হোস্টনাম নেব।)
URL http://1.2.3.4/1/
এর জন্য, ক্লায়েন্ট এই সম্ভাব্য স্ট্রিংগুলি চেষ্টা করবে:
1.2.3.4/1/
1.2.3.4/
URL http://example.co.uk/1
এর জন্য, ক্লায়েন্ট এই সম্ভাব্য স্ট্রিংগুলি চেষ্টা করবে:
example.co.uk/1
example.co.uk/
হ্যাশিং
গুগল সেফ ব্রাউজিং একচেটিয়াভাবে হ্যাশ ফাংশন হিসাবে SHA256 ব্যবহার করে। এই হ্যাশ ফাংশন উপরের অভিব্যক্তি প্রয়োগ করা উচিত.
সম্পূর্ণ 32-বাইট হ্যাশ, পরিস্থিতির উপর নির্ভর করে, 4 বাইট, 8 বাইট, বা 16 বাইটে কাটা হবে:
hashes.search পদ্ধতি ব্যবহার করার সময়, আমরা বর্তমানে অনুরোধে হ্যাশগুলিকে ঠিক 4 বাইটে ছোট করতে চাই। এই অনুরোধে অতিরিক্ত বাইট পাঠানো ব্যবহারকারীর গোপনীয়তার সাথে আপস করবে।
hashList.get পদ্ধতি বা hashLists.batchGet পদ্ধতি ব্যবহার করে স্থানীয় ডাটাবেসের জন্য তালিকাগুলি ডাউনলোড করার সময়, সার্ভার দ্বারা প্রেরিত হ্যাশের দৈর্ঘ্য হ্যাশের দৈর্ঘ্য নির্দেশকারী প্রত্যয় ধারণ করে এমন তালিকার নামকরণের মধ্যে এনকোড করা হয়। আরো বিস্তারিত জানার জন্য উপলব্ধ তালিকা বিভাগ দেখুন.
অন্য কিছু উল্লেখ না করা থাকলে, এই পৃষ্ঠার কন্টেন্ট Creative Commons Attribution 4.0 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-07-24 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["# URLs and Hashing\n\nThis section contains detailed specifications of how clients check URLs.\n\n### Canonicalization of URLs\n\nBefore any URLs are checked, the client is expected to perform some canonicalization on that URL.\n\nTo begin, we assume that the client has parsed the URL and made it valid according to RFC 2396. If the URL uses an internationalized domain name (IDN), the client should convert the URL to the ASCII Punycode representation. The URL must include a path component; that is, it must have at least one slash following the domain (`http://google.com/` instead of `http://google.com`).\n\nFirst, remove tab (0x09), CR (0x0d), and LF (0x0a) characters from the URL. Do not remove escape sequences for these characters (e.g. `%0a`).\n\nSecond, if the URL ends in a fragment, remove the fragment. For example, shorten `http://google.com/#frag` to `http://google.com/`.\n\nThird, repeatedly percent-unescape the URL until it has no more percent-escapes. (This may render the URL invalid.)\n\n**To canonicalize the hostname:**\n\nExtract the hostname from the URL and then:\n\n1. Remove all leading and trailing dots.\n2. Replace consecutive dots with a single dot.\n3. If the hostname can be parsed as an IPv4 address, normalize it to 4 dot-separated decimal values. The client should handle any legal IP-address encoding, including octal, hex, and fewer than four components.\n4. If the hostname can be parsed as a bracketed IPv6 address, normalize it by removing unnecessary leading zeroes in the components and collapsing zero components by using the double-colon syntax. For example `[2001:0db8:0000::1]` should be transformed into `[2001:db8::1]`. If the hostname is one of the two following special IPv6 address types, transform them into IPv4:\n - An IPv4-mapped IPv6 address, such as `[::ffff:1.2.3.4]`, which should be transformed into `1.2.3.4`;\n - A NAT64 address using [the well-known prefix 64:ff9b::/96](https://datatracker.ietf.org/doc/html/rfc6052#section-2.1), such as `[64:ff9b::1.2.3.4]`, which should be transformed into `1.2.3.4`.\n5. Lowercase the whole string.\n\n**To canonicalize the path:**\n\n1. Resolve the sequences `/../` and `/./` in the path by replacing `/./` with `/`, and removing `/../` along with the preceding path component.\n2. Replace runs of consecutive slashes with a single slash character.\n\nDo not apply these path canonicalizations to the query parameters.\n\nIn the URL, percent-escape all characters that are \\\u003c= ASCII 32, \\\u003e= 127, `#`, or `%`. The escapes should use uppercase hex characters.\n\n### Host-Suffix Path-Prefix Expressions\n\nOnce the URL is canonicalized, the next step is to create the suffix/prefix expressions. Each suffix/prefix expression consists of a host suffix (or full host) and a path prefix (or full path).\n\nThe client will form up to 30 different possible host suffix and path prefix combinations. These combinations use only the host and path components of the URL. The scheme, username, password, and port are discarded. If the URL includes query parameters, then at least one combination will include the full path and query parameters.\n\n**For the host**, the client will try at most five different strings. They are:\n\n- If the hostname is not an IPv4 or IPv6 literal, up to four hostnames formed by starting with the eTLD+1 domain and adding successive leading components. The determination of eTLD+1 should be based on the [Public Suffix List](https://publicsuffix.org/). For example, `a.b.example.com` would result in the eTLD+1 domain of `example.com` as well as the host with one additional host component `b.example.com`.\n- The exact hostname in the URL. Following the previous example, `a.b.example.com` would be checked.\n\n**For the path**, the client will try at most six different strings. They are:\n\n- The exact path of the URL, including query parameters.\n- The exact path of the URL, without query parameters.\n- The four paths formed by starting at the root (/) and successively appending path components, including a trailing slash.\n\nThe following examples illustrate the check behavior:\n\nFor the URL `http://a.b.com/1/2.html?param=1`, the client will try these possible strings: \n\n a.b.com/1/2.html?param=1\n a.b.com/1/2.html\n a.b.com/\n a.b.com/1/\n b.com/1/2.html?param=1\n b.com/1/2.html\n b.com/\n b.com/1/\n\nFor the URL `http://a.b.c.d.e.f.com/1.html`, the client will try these possible strings: \n\n a.b.c.d.e.f.com/1.html\n a.b.c.d.e.f.com/\n c.d.e.f.com/1.html\n c.d.e.f.com/\n d.e.f.com/1.html\n d.e.f.com/\n e.f.com/1.html\n e.f.com/\n f.com/1.html\n f.com/\n\n(Note: skip `b.c.d.e.f.com`, since we'll take only the last five hostname components, and the full hostname.)\n\nFor the URL `http://1.2.3.4/1/`, the client will try these possible strings: \n\n 1.2.3.4/1/\n 1.2.3.4/\n\nFor the URL `http://example.co.uk/1`, the client will try these possible strings: \n\n example.co.uk/1\n example.co.uk/\n\n### Hashing\n\nGoogle Safe Browsing exclusively uses SHA256 as the hash function. This hash function should be applied to the above expressions.\n\nThe full 32-byte hash will, depending on the circumstances, be truncated to 4 bytes, 8 bytes, or 16 bytes:\n\n- When using the [hashes.search method](/safe-browsing/reference/rest/v5/hashes/search), we currently require the hashes in the request to be truncated to exactly 4 bytes. Sending additional bytes in this request will compromise user privacy.\n\n- When downloading the lists for the local database using the [hashList.get method](/safe-browsing/reference/rest/v5/hashList/get) or the [hashLists.batchGet method](/safe-browsing/reference/rest/v5/hashLists/batchGet), the length of the hashes sent by the server is encoded within the naming convention of the lists that contain suffix indicating hash length. See [Available Lists](/safe-browsing/reference/Local.Database#available-lists) section for more details."]]