"use strict";(self.webpackChunkdocs_site=self.webpackChunkdocs_site||[]).push([[5789],{5540:(e,n,l)=>{l.r(n),l.d(n,{assets:()=>o,contentTitle:()=>a,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});const s=JSON.parse('{"id":"XXTLanControl.lua/web-file/sha1","title":"Calculate File SHA1 (LCC.web_file.sha1)","description":"Signature","source":"@site/i18n/en/docusaurus-plugin-content-docs/current/XXTLanControl.lua/web-file/sha1.md","sourceDirName":"XXTLanControl.lua/web-file","slug":"/XXTLanControl.lua/web-file/sha1","permalink":"/docs/en/XXTLanControl.lua/web-file/sha1","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":70,"frontMatter":{"sidebar_position":70},"sidebar":"tutorialSidebar","previous":{"title":"Calculate File MD5 (LCC.web_file.md5)","permalink":"/docs/en/XXTLanControl.lua/web-file/md5"},"next":{"title":"Calculate File CRC32 (LCC.web_file.crc32)","permalink":"/docs/en/XXTLanControl.lua/web-file/crc32"}}');var r=l(4848),t=l(8453);const i={sidebar_position:70},a="Calculate File SHA1 (LCC.web_file.sha1)",o={},c=[{value:"Signature",id:"signature",level:2},{value:"Parameters",id:"parameters",level:2},{value:"Returns",id:"returns",level:2},{value:"Notes",id:"notes",level:2},{value:"Example",id:"example",level:2}];function d(e){const n={blockquote:"blockquote",br:"br",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",ul:"ul",...(0,t.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"calculate-file-sha1-lccweb_filesha1",children:"Calculate File SHA1 (LCC.web_file.sha1)"})}),"\n",(0,r.jsx)(n.h2,{id:"signature",children:"Signature"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:"hash, err = LCC.web_file.sha1(path, timeout?)\n"})}),"\n",(0,r.jsx)(n.h2,{id:"parameters",children:"Parameters"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["path",(0,r.jsx)(n.br,{}),"\n","String. File to hash."]}),"\n",(0,r.jsxs)(n.li,{children:["timeout",(0,r.jsx)(n.br,{}),"\n","Number, optional. Request timeout in seconds, default ",(0,r.jsx)(n.code,{children:"60"}),"."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"returns",children:"Returns"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:["hash",(0,r.jsx)(n.br,{}),"\n","String. 40-character hexadecimal SHA1 digest; ",(0,r.jsx)(n.code,{children:"nil"})," on failure."]}),"\n",(0,r.jsxs)(n.li,{children:["err",(0,r.jsx)(n.br,{}),"\n","String or ",(0,r.jsx)(n.code,{children:"nil"}),". Error description when the call fails."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"notes",children:"Notes"}),"\n",(0,r.jsxs)(n.blockquote,{children:["\n",(0,r.jsxs)(n.p,{children:["Computes the file's SHA1 digest on the controller.",(0,r.jsx)(n.br,{}),"\n","Returns ",(0,r.jsx)(n.code,{children:"nil"})," with an error message when the path is missing or not a file."]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"example",children:"Example"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-lua",children:'local sha1, err = LCC.web_file.sha1("/assets/config.json")\nif sha1 then\n    print("SHA1=" .. sha1)\nend\n'})})]})}function u(e={}){const{wrapper:n}={...(0,t.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},8453:(e,n,l)=>{l.d(n,{R:()=>i,x:()=>a});var s=l(6540);const r={},t=s.createContext(r);function i(e){const n=s.useContext(t);return s.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:i(e.components),s.createElement(t.Provider,{value:n},e.children)}}}]);