1import{j as e}from"./main-5zZu2UcF.js";function n(){return e.jsxs("section",{className:"py-12",children:[e.jsx("h2",{className:"text-3xl font-bold text-gray-900 dark:text-white mb-4",children:"Verifying Against the Standard"}),e.jsxs("div",{className:"prose-invert space-y-6",children:[e.jsxs("p",{className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:["The canonical CRC-32 test vector is the ASCII string"," ",e.jsx("code",{className:"text-sm bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded font-mono",children:'"123456789"'}),". Every correct CRC-32 implementation must produce"," ",e.jsx("code",{className:"text-sm bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded font-mono text-orange-400",children:"0xCBF43926"}),". This is how you know your hardware matches the spec that governs every Ethernet chip in the world."]}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:["You can verify this from the Simten editor using the"," ",e.jsx("code",{className:"text-sm bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded font-mono",children:"crc-32"})," ","npm package. Paste the following into the editor on any page:"]}),e.jsxs("div",{className:"rounded-lg bg-gray-900 border border-gray-700/50 overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between px-4 py-2 border-b border-gray-700/50",children:[e.jsx("span",{className:"text-xs font-mono text-gray-500",children:"editor"}),e.jsx("span",{className:"text-xs text-gray-600",children:"paste into Simten editor"})]}),e.jsxs("pre",{className:"p-4 text-sm font-mono overflow-x-auto leading-relaxed",children:[e.jsx("span",{className:"text-gray-500",children:'// CRC-32 test vector: "123456789" â 0xCBF43926'}),` 2`,e.jsx("span",{className:"text-blue-400",children:"import"})," CRC32"," ",e.jsx("span",{className:"text-blue-400",children:"from"})," ",e.jsx("span",{className:"text-green-400",children:"'crc-32'"}),`; 3 4`,e.jsx("span",{className:"text-gray-500",children:"// The standard test vector"}),` 5`,e.jsx("span",{className:"text-blue-400",children:"const"})," result = CRC32.",e.jsx("span",{className:"text-yellow-400",children:"str"}),"(",e.jsx("span",{className:"text-green-400",children:'"123456789"'}),`); 6`,"console.",e.jsx("span",{className:"text-yellow-400",children:"log"}),"((result >>> 0).",e.jsx("span",{className:"text-yellow-400",children:"toString"}),"(16)); ",e.jsx("span",{className:"text-gray-500",children:"// cbf43926"}),` 7 8`,e.jsx("span",{className:"text-gray-500",children:"// Verify individual bytes"}),` 9`,e.jsx("span",{className:"text-blue-400",children:"const"})," bytes = [49, 50, 51, 52, 53, 54, 55, 56, 57]; ",e.jsx("span",{className:"text-gray-500",children:'// "1" through "9"'}),` 10`,"console.",e.jsx("span",{className:"text-yellow-400",children:"log"}),"(bytes.",e.jsx("span",{className:"text-yellow-400",children:"map"}),"(b => String.",e.jsx("span",{className:"text-yellow-400",children:"fromCharCode"}),"(b)).",e.jsx("span",{className:"text-yellow-400",children:"join"}),"(",e.jsx("span",{className:"text-green-400",children:"''"}),")); ",e.jsx("span",{className:"text-gray-500",children:"// 123456789"}),` 11`]})]}),e.jsxs("p",{className:"text-gray-600 dark:text-gray-300 leading-relaxed",children:["The"," ",e.jsx("code",{className:"text-sm bg-gray-100 dark:bg-gray-800 px-1.5 py-0.5 rounded font-mono",children:">>> 0"})," ","converts the signed 32-bit JavaScript integer to an unsigned value before converting to hex. CRC-32 is always an unsigned 32-bit number; JavaScript âs bitwise operators work on signed 32-bit integers, so the coercion is necessary to print it correctly."]}),e.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-3 gap-3 text-sm font-mono",children:[{input:'"123456789"',crc:"0xCBF43926",label:"Standard test vector"},{input:'"" (empty)',crc:"0x00000000",label:"Empty string"},{input:'"a"',crc:"0xE8B7BE43",label:"Single character"}].map(({input:s,crc:t,label:a})=>e.jsxs("div",{className:"bg-gray-100 dark:bg-gray-900/60 border border-gray-200 dark:border-gray-700/50 rounded p-3",children:[e.jsx("div",{className:"text-gray-500 dark:text-gray-400 text-xs mb-1",children:a}),e.jsx("div",{className:"text-gray-900 dark:text-white text-xs",children:s}),e.jsx("div",{className:"text-gray-500 text-xs mt-2 mb-1",children:"CRC-32"}),e.jsx("div",{className:"text-orange-400",children:t})]},s))}),e.jsxs("div",{className:"rounded-lg border border-gray-700/50 bg-gray-100/50 dark:bg-gray-900/50 p-5",children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-900 dark:text-white mb-2",children:"Where youâll find CRC-32 in the wild"}),e.jsxs("ul",{className:"space-y-1 text-sm text-gray-500 dark:text-gray-400",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-gray-900 dark:text-gray-300",children:"Ethernet frames"}),": the 4-byte FCS (Frame Check Sequence) field at the end of every packet"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-gray-900 dark:text-gray-300",children:"ZIP archives"}),": stored in the local file header and central directory for each file"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-gray-900 dark:text-gray-300",children:"PNG images"}),": each chunk ends with a CRC-32 of the chunk type and data"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-gray-900 dark:text-gray-300",children:"NVMe / SATA"}),": every sector has a CRC computed in the drive controller before writing to flash"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-gray-900 dark:text-gray-300",children:"gzip / zlib"}),": the checksum appended to compressed streams"]}
11)]})]})]})]})}export{n as VerifySection};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.