1(self.webpackChunkopa_website=self.webpackChunkopa_website||[]).push([[21879],{4432:(e,t,n)=>{var o={"./config":98301,"./config.json":98301,"./input":19933,"./input.json":19933,"./intro.md":32680,"./output":10506,"./output.json":10506,"./policy.rego":92546,"./title.txt":35187};function r(e){var t=i(e);return n(t)}function i(e){if(!n.o(o,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return o[e]}r.keys=function(){return Object.keys(o)},r.resolve=i,e.exports=r,r.id=4432},10506:e=>{"use strict";e.exports=JSON.parse('{"computed_digest":"ea99819f665c10c744cbbf8da651c37a","digest_valid":true,"payload_json":"{\\"action\\":\\"read\\",\\"resource\\":\\"/api/users\\",\\"user\\":\\"alice\\"}"}')},19933:e=>{"use strict";e.exports=JSON.parse('{"payload":{"user":"alice","action":"read","resource":"/api/users"},"expected_digest":"ea99819f665c10c744cbbf8da651c37a"}')},28453:(e,t,n)=>{"use strict";n.d(t,{R:()=>s,x:()=>c});var o=n(96540);const r={},i=o.createContext(r);function s(e){const t=o.useContext(i);return o.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:s(e.components),o.createElement(i.Provider,{value:t},e.children)}},32680:(e,t,n)=>{"use strict";n.r(t),n.d(t,{contentTitle:()=>s,default:()=>d,frontMatter:()=>i,toc:()=>c});var o=n(74848),r=n(28453);const i={},s=void 0,c=[];function a(e){const t={code:"code",p:"p",...(0,r.R)(),...e.components};return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(t.p,{children:["This example shows how to use ",(0,o.jsx)(t.code,{children:"crypto.md5"})," to verify payload integrity by computing a digest of the JSON representation and comparing it with an expected value."]}),"\n",(0,o.jsx)(t.p,{children:"Content verification is helpful where you need to ensure data hasn't been tampered with or missed during transmission. The digest acts as a fingerprint - any change to the payload will result in a different digest."}),"\n",(0,o.jsxs)(t.p,{children:["Change any value in the ",(0,o.jsx)(t.code,{children:"payload"})," object (like the user name or resource path) and re-run the example. You'll see ",(0,o.jsx)(t.code,{children:"digest_valid"})," becomes ",(0,o.jsx)(t.code,{children:"false"}),", demonstrating how any change is detected."]})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,o.jsx)(t,{...e,children:(0,o.jsx)(a,{...e})}):a(e)}},35187:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});const o="Payload Digest Verification\n\n"},82691:(e,t,n)=>{"use strict";n.r(t),n.d(t,{assets:()=>a,contentTitle:()=>c,default:()=>p,frontMatter:()=>s,metadata:()=>o,toc:()=>d});const o=JSON.parse('{"id":"policy-reference/builtins/crypto","title":"Cryptography Built-ins","description":"Examples","source":"@site/docs/policy-reference/builtins/crypto.mdx","sourceDirName":"policy-reference/builtins","slug":"/policy-reference/builtins/crypto","permalink":"/docs/policy-reference/builtins/crypto","draft":false,"unlisted":false,"tags":[],"version":"current","frontMatter":{"title":"Cryptography Built-ins","sidebar_label":"Cryptography"},"sidebar":"docsSidebar","previous":{"title":"Type Conversions","permalink":"/docs/policy-reference/builtins/conversions"},"next":{"title":"Encoding","permalink":"/docs/policy-reference/builtins/encoding"}}');var r=n(74848),i=n(28453);const s={title:"Cryptography Built-ins",sidebar_label:"Cryptography"},c=void 0,a={},d=[{value:"Examples",id:"examples",level:2},{value:"<code>crypto.md5</code>",id:"cryptomd5",level:3}];function l(e){const t={code:"code",h2:"h2",h3:"h3",...(0,i.R)(),...e.components},{BuiltinTable:o,PlaygroundExample:s}=t;return o||u("BuiltinTable",!0),s||u("PlaygroundExample",!0),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o,{category:"crypto"}),"\n",(0,r.jsx)(t.h2,{id:"examples",children:"Examples"}),"\n",(0,r.jsx)(t.h3,{id:"cryptomd5",children:(0,r.jsx)(t.code,{children:"crypto.md5"})}),"\n",(0,r.jsx)(s,{dir:n(4432)})]})}function p(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(l,{...e})}):l(e)}function u(e,t){throw new Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},92546:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});const o="package crypto_digest_verification\n\n# Verify payload integrity using MD5 digest\n# (commonly used for c
1ontent verification)\npayload_json := json.marshal(input.payload)\ncomputed_digest := crypto.md5(payload_json)\ndigest_valid := computed_digest == input.expected_digest\n"},98301:e=>{"use strict";e.exports=JSON.parse('{"showInput":true,"showData":false,"showTitles":false,"command":"data.crypto_digest_verification","titleSize":4}')}}]);
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.