ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.
iso8583sim.security.macFor testing and simulation only. Production MACs are generated inside an HSM.
Functions
generate_mac()
def generate_mac( data: str | bytes, key: str | bytes, algorithm: int = 3, padding: int = 1, length: int = 8,) -> str
Generate an ISO 9797-1 MAC with DES based block ciphers.Algorithm 1 is a CBC-MAC with the whole key (single, double or triple length).
Algorithm 3 is the retail MAC (ANSI X9.19): single DES CBC with the left key half,
then decrypt with the right half and encrypt with the left half on the final block.Parameters
str | bytes
required
Data to authenticate. A str is encoded as ASCII, which is how this
simulator carries ISO 8583 messages.
str | bytes
required
MAC key as bytes or hex (8, 16 or 24 bytes for algorithm 1; 16 for algorithm 3)
int
default:"3"
ISO 9797-1 MAC algorithm: 1 or 3
int
default:"1"
ISO 9797-1 padding method: 1 or 2
int
default:"8"
MAC length in bytes, 4 to 8. Truncation keeps the leftmost bytes.
Check the MAC in field 64 or 128 of a raw message built by this simulator.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"iso8583sim","description":"Parse, build, validate and simulate ISO 8583 payment messages in Python.","colors":{"primary":"#5f7500","light":"#a6c433","dark":"#4a5c00"},"logo":{"light":"https://mintcdn.com/iso8583sim/ZhjVhzk39SWG2_E-/logo/light.svg?fit=max\u0026auto=format\u0026n=ZhjVhzk39SWG2_E-\u0026q=85\u0026s=30e70d0e911fd951334821b22aabddd6","dark":"https://mintcdn.com/iso8583sim/ZhjVhzk39SWG2_E-/logo/dark.svg?fit=max\u0026auto=format\u0026n=ZhjVhzk39SWG2_E-\u0026q=85\u0026s=58c136e87afbb59d86c7a0e7c25936ab","href":"https://iso8583sim.com"},"favicon":"https://mintcdn.com/iso8583sim/ZhjVhzk39SWG2_E-/favicon.svg?fit=max\u0026auto=format\u0026n=ZhjVhzk39SWG2_E-\u0026q=85\u0026s=2a487664f2c574f202e891f8d4b669ef","api":{"playground":{"proxy":false}},"background":{"color":{"light":"#f4f5f2","dark":"#0f120f"}},"navbar":{"links":[{"href":"https://pypi.org/project/iso8583sim/","label":"PyPI"}],"primary":{"type":"github","href":"https://github.com/bassrehab/ISO8583-Simulator"}},"footer":{"socials":{"github":"https://github.com/bassrehab/ISO8583-Simulator","website":"https://iso8583sim.com"}},"fonts":{"family":"IBM Plex Sans"},"icons":{"library":"lucide"},"contextual":{"options":["copy","view","chatgpt","claude","cursor","vscode"],"display":"header"},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://iso8583sim.com"},{"anchor":"Changelog","icon":"list","href":"https://github.com/bassrehab/ISO8583-Simulator/blob/main/CHANGELOG.md"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"iso8583sim","hasAudioNarration":false,"actualSubdomain":"iso8583sim","customDomains":["iso8583sim.com"],"gitSource":{"type":"github","owner":"bassrehab","repo":"iso8583-simulator","deployBranch":"main","contentDirectory":"docs","isPrivate":true,"mountPath":"","label":""},"entitlements":{"AI_CHAT":{"status":"DISABLED"},"WEB_MCP":{"status":"DISABLED"},"NARRATION":{"status":"DISABLED"}},"buildId":"6ac0f818b2b0263bbe982c60","clientVersion":"0.0.4270","searchFilterCounts":[{"language":"default","tag":"Guides","count":32},{"language":"default","tag":"Python API","count":26},{"language":"default","tag":"Core","count":21},{"language":"default","tag":"REST API","count":16},{"language":"default","tag":"Messages","count":6},{"language":"default","tag":"Get started","count":5},{"language":"default","tag":"LLM","count":4},{"language":"default","tag":"Networking","count":4},{"language":"default","tag":"Tools and interfaces","count":4},{"language":"default","tag":"LLM features","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableContextualStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"/docs","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"site-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"starter-pricing","enabled":true,"variant":{"name":"treatment","enabled":true,"payload":{"type":"string","value":"treatment"},"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"wildcard-email-auth","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[]}
{"page":{"pagePath":"api/security/mac","slug":"/api/security/mac","pageMetadata":{"title":"MACs","description":"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.","href":"/api/security/mac"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,..._provideComponents(),...props.components},{CodeBlock,Heading,ResponseField}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!ResponseField)_missingMdxReference(`ResponseField`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:_jsx(_components.code,{children:`iso8583sim.security.mac`})}),`\n`,_jsx(_components.p,{children:`For testing and simulation only. Production MACs are generated inside an HSM.`}),`\n`,_jsx(Heading,{level:`2`,id:`functions`,children:`Functions`}),`\n`,_jsx(Heading,{level:`3`,id:`generate_mac`,children:_jsx(_components.code,{children:`generate_mac()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` generate_mac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` algorithm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` padding`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` length`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 8`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Generate an ISO 9797-1 MAC with DES based block ciphers.`}),`\n`,_jsx(_components.p,{children:`Algorithm 1 is a CBC-MAC with the whole key (single, double or triple length).\nAlgorithm 3 is the retail MAC (ANSI X9.19): single DES CBC with the left key half,\nthen decrypt with the right half and encrypt with the left half on the final block.`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters`})}),`\n`,_jsx(ResponseField,{name:`data`,type:`str | bytes`,required:true,id:`param-data`,children:_jsx(_components.p,{children:`Data to authenticate. A str is encoded as ASCII, which is how this\nsimulator carries ISO 8583 messages.`})}),`\n`,_jsx(ResponseField,{name:`key`,type:`str | bytes`,required:true,id:`param-key`,children:_jsx(_components.p,{children:`MAC key as bytes or hex (8, 16 or 24 bytes for algorithm 1; 16 for algorithm 3)`})}),`\n`,_jsx(ResponseField,{name:`algorithm`,type:`int`,default:`3`,id:`param-algorithm`,children:_jsx(_components.p,{children:`ISO 9797-1 MAC algorithm: 1 or 3`})}),`\n`,_jsx(ResponseField,{name:`padding`,type:`int`,default:`1`,id:`param-padding`,children:_jsx(_components.p,{children:`ISO 9797-1 padding method: 1 or 2`})}),`\n`,_jsx(ResponseField,{name:`length`,type:`int`,default:`8`,id:`param-length`,children:_jsx(_components.p,{children:`MAC length in bytes, 4 to 8. Truncation keeps the leftmost bytes.`})}),`\n`,_jsx(ResponseField,{name:`Returns`,type:`str`,id:`param-returns`,children:_jsx(_components.p,{children:`The MAC as uppercase hex`})}),`\n`,_jsx(Heading,{level:`3`,id:`verify_mac`,children:_jsx(_components.code,{children:`verify_mac()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` verify_mac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` data`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` mac`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` algorithm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` padding`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bool`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Check a MAC. The expected length is taken from the given MAC.`}),`\n`,_jsx(Heading,{level:`3`,id:`mac_field`,children:_jsx(_components.code,{children:`mac_field()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`1`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`1`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` mac_field`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`fields`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: dict[`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`]) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Return which field carries the MAC: 128 when the message has a secondary bitmap, else 64.`}),`\n`,_jsx(Heading,{level:`3`,id:`sign_message`,children:_jsx(_components.code,{children:`sign_message()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` sign_message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: ISO8583Message,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` builder`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: ISO8583Builder `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` algorithm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` padding`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Build a message with its MAC in field 64 (or 128 with a secondary bitmap).`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Parameters`})}),`\n`,_jsx(ResponseField,{name:`message`,type:`ISO8583Message`,required:true,id:`param-message`,children:_jsx(_components.p,{children:`Message to build. Any existing MAC field is replaced.`})}),`\n`,_jsx(ResponseField,{name:`key`,type:`str | bytes`,required:true,id:`param-key-1`,children:_jsx(_components.p,{children:`MAC key as bytes or hex`})}),`\n`,_jsx(ResponseField,{name:`builder`,type:`ISO8583Builder | None`,default:`None`,id:`param-builder`,children:_jsx(_components.p,{children:`Builder to use (defaults to one for the message’s version)`})}),`\n`,_jsx(ResponseField,{name:`algorithm`,type:`int`,default:`3`,id:`param-algorithm-1`,children:_jsx(_components.p,{children:`ISO 9797-1 MAC algorithm: 1 or 3`})}),`\n`,_jsx(ResponseField,{name:`padding`,type:`int`,default:`1`,id:`param-padding-1`,children:_jsx(_components.p,{children:`ISO 9797-1 padding method: 1 or 2`})}),`\n`,_jsx(ResponseField,{name:`Returns`,type:`str`,id:`param-returns-1`,children:_jsx(_components.p,{children:`The raw message with the MAC filled in`})}),`\n`,_jsx(Heading,{level:`3`,id:`verify_message`,children:_jsx(_components.code,{children:`verify_message()`})}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`python`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`python`,children:_jsxs(_components.code,{language:`python`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`def`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` verify_message`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` raw`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` key`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`str`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` bytes`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` algorithm`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 3`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` padding`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`int`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 1`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` version`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: ISO8583Version `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`|`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` None`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) -> `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`bool`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Check the MAC in field 64 or 128 of a raw message built by this simulator.`})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"MACs","description":"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.","href":"/api/security/mac"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Functions","slug":"functions","depth":2,"children":[{"title":"generate_mac()","slug":"generate_mac","depth":3,"children":[]},{"title":"verify_mac()","slug":"verify_mac","depth":3,"children":[]},{"title":"mac_field()","slug":"mac_field","depth":3,"children":[]},{"title":"sign_message()","slug":"sign_message","depth":3,"children":[]},{"title":"verify_message()","slug":"verify_message","depth":3,"children":[]}]}],"codeExamples":{}},"jsLinks":[],"subdomain":"iso8583sim","siteName":"iso8583sim","title":"MACs - iso8583sim","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-27T17:42:11.630Z","originalFileLocation":"api/security/mac.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.\">\u003cmeta data-mint-head name=\"application-name\" content=\"iso8583sim\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"MACs - iso8583sim\">\u003cmeta data-mint-head property=\"og:description\" content=\"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"iso8583sim\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://iso8583sim.com/docs/api/security/mac\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://iso8583sim.mintlify.site/docs/_mintlify/api/og/v2?division=Security\u0026amp;title=MACs\u0026amp;description=ISO+9797-1+message+authentication+codes+for+ISO+8583+fields+64+and+128.\u0026amp;theme=c7ae27398c89a0d2eda0102e\u0026amp;signature=d78d416912c53573e95e32e38a2fc3127ba76e9d8bb30059434cb927827dd7e1\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"MACs - iso8583sim\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://iso8583sim.mintlify.site/docs/_mintlify/api/og/v2?division=Security\u0026amp;title=MACs\u0026amp;description=ISO+9797-1+message+authentication+codes+for+ISO+8583+fields+64+and+128.\u0026amp;theme=c7ae27398c89a0d2eda0102e\u0026amp;signature=d78d416912c53573e95e32e38a2fc3127ba76e9d8bb30059434cb927827dd7e1\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/docs/mintlify-assets/_mintlify/favicons/iso8583sim/Pu86LjvG04WQHsjW/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"iso8583sim\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#5f7500\">\u003clink data-mint-head rel=\"canonical\" href=\"https://iso8583sim.com/docs/api/security/mac\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/docs/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/docs/api/security/mac.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://iso8583sim.com/#organization\",\"name\":\"iso8583sim\",\"url\":\"https://iso8583sim.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/iso8583sim/ZhjVhzk39SWG2_E-/logo/light.svg?fit=max\u0026auto=format\u0026n=ZhjVhzk39SWG2_E-\u0026q=85\u0026s=30e70d0e911fd951334821b22aabddd6\"}},{\"@type\":\"WebSite\",\"@id\":\"https://iso8583sim.com/docs#website\",\"name\":\"iso8583sim\",\"url\":\"https://iso8583sim.com/docs\",\"publisher\":{\"@id\":\"https://iso8583sim.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://iso8583sim.com/docs/api/security/mac#webpage\",\"url\":\"https://iso8583sim.com/docs/api/security/mac\",\"name\":\"MACs\",\"description\":\"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.\",\"dateModified\":\"2026-09-27T17:42:11.630Z\",\"isPartOf\":{\"@id\":\"https://iso8583sim.com/docs#website\"},\"breadcrumb\":{\"@id\":\"https://iso8583sim.com/docs/api/security/mac#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://iso8583sim.com/docs/api/security/mac#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Security\",\"item\":\"https://iso8583sim.com/docs/api/security/pinblock\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"MACs\",\"item\":\"https://iso8583sim.com/docs/api/security/mac\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://iso8583sim.com/docs/api/security/mac#article\",\"headline\":\"MACs\",\"name\":\"MACs\",\"description\":\"ISO 9797-1 message authentication codes for ISO 8583 fields 64 and 128.\",\"url\":\"https://iso8583sim.com/docs/api/security/mac\",\"mainEntityOfPage\":{\"@id\":\"https://iso8583sim.com/docs/api/security/mac#webpage\"},\"dateModified\":\"2026-09-27T17:42:11.630Z\",\"publisher\":{\"@id\":\"https://iso8583sim.com/#organization\"},\"isPartOf\":{\"@id\":\"https://iso8583sim.com/docs#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"iso8583sim\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"iso8583sim\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/docs/api/security/mac.md","siteName":"iso8583sim","nav":{"global":{"anchors":[{"anchor":"Website","icon":"globe","href":"https://iso8583sim.com"},{"anchor":"Changelog","icon":"list","href":"https://github.com/bassrehab/ISO8583-Simulator/blob/main/CHANGELOG.md"}]},"tabs":[{"tab":"Guides","pages":[{"title":"Guides","href":""}]},{"tab":"Python API","groups":[{"group":"Core","pages":[{"title":"Types","href":"/api/core/types"},{"title":"Parser","href":"/api/core/parser"},{"title":"Builder","href":"/api/core/builder"},{"title":"Validator","href":"/api/core/validator"},{"title":"Network rules","href":"/api/core/network_rules"},{"title":"EMV","href":"/api/core/emv"},{"title":"Codes","href":"/api/core/codes"},{"title":"Describe","href":"/api/core/describe"},{"title":"Convert","href":"/api/core/convert"},{"title":"Samples","href":"/api/core/samples"},{"title":"Pool","href":"/api/core/pool"}]},{"group":"Security","pages":[{"title":"PIN blocks","description":"ISO 9564-1 PIN blocks (formats 0, 1, 3 and 4).","href":"/api/security/pinblock"},{"title":"MACs","href":"/api/security/mac"}]},{"group":"Wire formats","pages":[{"title":"WireFormat","description":"Wire formats: how an ISO 8583 message is laid out as bytes on the network.","href":"/api/wire/format"},{"title":"Encode and decode","href":"/api/wire/codec"}]},{"group":"Networking","pages":[{"title":"Framing","href":"/api/net/framing"},{"title":"Client","href":"/api/net/client"},{"title":"Mock host","href":"/api/net/host"},{"title":"Load testing","href":"/api/net/load"}]},{"group":"LLM","pages":[{"title":"Base","href":"/api/llm/base"},{"title":"Explainer","href":"/api/llm/explainer"},{"title":"Generator","href":"/api/llm/generator"},{"title":"Providers","href":"/api/llm/providers"}]},{"group":"Servers","pages":[{"title":"MCP server","href":"/api/mcp/server"},{"title":"REST app","href":"/api/web/app"}]},{"group":"Demo","pages":[{"title":"Demo helpers","href":"/api/demo"}]}]},{"tab":"REST API","pages":[{"title":"REST API","href":"/rest"}]}]},"basePath":"","title":"MACs - iso8583sim","deploymentId":"dpl_53YqbBPsHdrqSGqXiWPGU7csRVod","buildId":"dpl_53YqbBPsHdrqSGqXiWPGU7csRVod","dynamics":[],"chunks":[]}