{"id":17241197,"url":"https://github.com/kommitters/elixir_xdr","last_synced_at":"2025-08-30T09:33:50.808Z","repository":{"id":45663279,"uuid":"260066086","full_name":"kommitters/elixir_xdr","owner":"kommitters","description":"Process XDR data with Elixir. Based on the RFC4506 standard","archived":false,"fork":false,"pushed_at":"2025-08-18T13:53:28.000Z","size":259,"stargazers_count":11,"open_issues_count":2,"forks_count":7,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-08-18T15:36:58.243Z","etag":null,"topics":["crypto","decoding","elixir","encoding","hacktoberfest","hex","stellar","xdr"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/elixir_xdr","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kommitters.png","metadata":{"funding":{"github":["kommitters"]},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2020-04-29T23:12:33.000Z","updated_at":"2024-05-31T19:02:57.000Z","dependencies_parsed_at":"2023-10-03T07:16:10.462Z","dependency_job_id":"38467df9-d226-43fa-a144-503a07a67c5f","html_url":"https://github.com/kommitters/elixir_xdr","commit_stats":{"total_commits":106,"total_committers":12,"mean_commits":8.833333333333334,"dds":0.7264150943396226,"last_synced_commit":"acf2f9fab622b7a03b2da3be61f8da1afebf7acc"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/kommitters/elixir_xdr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kommitters%2Felixir_xdr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kommitters%2Felixir_xdr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kommitters%2Felixir_xdr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kommitters%2Felixir_xdr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kommitters","download_url":"https://codeload.github.com/kommitters/elixir_xdr/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kommitters%2Felixir_xdr/sbom","scorecard":{"id":381997,"data":{"date":"2023-09-06T22:34:44Z","repo":{"name":"github.com/kommitters/elixir_xdr","commit":"cfd4334e773dc71f6758a84e748269ecb07ac75b"},"scorecard":{"version":"v4.11.0","commit":"4edb07802fdad892fa8d10f8fd47666b6ccc27c9"},"score":7.5,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#binary-artifacts"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#branch-protection"}},{"name":"CI-Tests","score":10,"reason":"30 out of 30 merged PRs checked by a CI test -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project runs tests before pull requests are merged.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#ci-tests"}},{"name":"CII-Best-Practices","score":5,"reason":"badge detected: passing","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#cii-best-practices"}},{"name":"Code-Review","score":4,"reason":"found 14 unreviewed changesets out of 27 -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#code-review"}},{"name":"Contributors","score":10,"reason":"4 different organizations found -- score normalized to 10","details":["Info: contributors work for gieu,kommit,kommitters,kommitters @podnation"],"documentation":{"short":"Determines if the project has a set of contributors from multiple organizations (e.g., companies).","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#contributors"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#dangerous-workflow"}},{"name":"Dependency-Update-Tool","score":10,"reason":"update tool detected","details":["Info: tool 'RenovateBot' is used: renovate.json:1","Warn: tool 'Dependabot' is not used: Follow the instructions from https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/configuration-options-for-dependency-updates. (Low effort)","Warn: tool 'PyUp' is not used: Follow the instructions from https://docs.pyup.io/docs. (Low effort)","Warn: tool 'Sonatype Lift' is not used: Follow the instructions from https://help.sonatype.com/lift/getting-started. (Low effort)"],"documentation":{"short":"Determines if the project uses a dependency update tool.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#dependency-update-tool"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":null,"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: License file found in expected location: LICENSE:1","Info: FSF or OSI recognized license: LICENSE:1"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#license"}},{"name":"Maintained","score":3,"reason":"4 commit(s) out of 30 and 0 issue activity out of 13 found in the last 90 days -- score normalized to 3","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"no published package detected","details":["Warn: no GitHub/GitLab publishing workflow detected"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":10,"reason":"all dependencies are pinned","details":["Info: GitHub-owned GitHubActions are pinned","Info: Third-party GitHubActions are pinned","Info: Dockerfile dependencies are pinned","Info: no insecure (not pinned by hash) dependency downloads found in Dockerfiles","Info: no insecure (not pinned by hash) dependency downloads found in shell scripts","Info: Pip installs are pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool","Warn: CodeQL tool not detected"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#sast"}},{"name":"Security-Policy","score":9,"reason":"security policy file detected","details":["Info: Found linked content in security policy: SECURITY.md","Info: Found text in security policy: SECURITY.md","Warn: One or no descriptive hints of disclosure, vulnerability, and/or timelines in security policy: SECURITY.md","Info: security policy detected in current repo: SECURITY.md"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#security-policy"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":["Warn: no GitHub releases found"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#signed-releases"}},{"name":"Token-Permissions","score":10,"reason":"tokens are read-only in GitHub workflows","details":["Info: topLevel 'contents' permission set to 'read': .github/workflows/cd.yml:9","Info: topLevel 'contents' permission set to 'read': .github/workflows/ci.yml:11","Info: topLevel permissions set to 'read-all': .github/workflows/scorecards.yml:11","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#token-permissions"}},{"name":"Vulnerabilities","score":10,"reason":"no vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/4edb07802fdad892fa8d10f8fd47666b6ccc27c9/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T15:40:17.052Z","repository_id":45663279,"created_at":"2025-08-18T15:40:17.052Z","updated_at":"2025-08-18T15:40:17.052Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272833298,"owners_count":25000870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crypto","decoding","elixir","encoding","hacktoberfest","hex","stellar","xdr"],"created_at":"2024-10-15T06:08:08.174Z","updated_at":"2025-08-30T09:33:50.786Z","avatar_url":"https://github.com/kommitters.png","language":"Elixir","funding_links":["https://github.com/sponsors/kommitters"],"categories":[],"sub_categories":[],"readme":"# Elixir XDR\n\n![stability-beta](https://img.shields.io/badge/stability-beta-33bbff.svg?style=for-the-badge)\n![Build Badge](https://img.shields.io/github/actions/workflow/status/kommitters/elixir_xdr/ci.yml?branch=main\u0026style=for-the-badge)\n[![Coverage Status](https://img.shields.io/coveralls/github/kommitters/elixir_xdr?style=for-the-badge)](https://coveralls.io/github/kommitters/elixir_xdr)\n[![Version Badge](https://img.shields.io/hexpm/v/elixir_xdr?style=for-the-badge)](https://hexdocs.pm/elixir_xdr)\n![Downloads Badge](https://img.shields.io/hexpm/dt/elixir_xdr?style=for-the-badge)\n[![License badge](https://img.shields.io/hexpm/l/elixir_xdr.svg?style=for-the-badge)](https://github.com/kommitters/elixir_xdr/blob/master/LICENSE.md)\n[![OpenSSF Best Practices](https://img.shields.io/cii/summary/6466?label=openssf%20best%20practices\u0026style=for-the-badge)](https://bestpractices.coreinfrastructure.org/projects/6466)\n[![OpenSSF Scorecard](https://img.shields.io/ossf-scorecard/github.com/kommitters/elixir_xdr?label=openssf%20scorecard\u0026style=for-the-badge)](https://api.securityscorecards.dev/projects/github.com/kommitters/elixir_xdr)\n\nXDR is an open data format, specified in [RFC 4506](http://tools.ietf.org/html/rfc4506.html). This library provides a way to decode and encode XDR data from Elixir. Extend with ease to other XDR types.\n\n## Installation\n[Available in Hex][hex], Add `elixir_xdr` to your dependencies list in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:elixir_xdr, \"~\u003e 0.3.12\"}\n  ]\nend\n```\n\n## Implemented types\n\nThe following XDR types are completely implemented in this library:\n```elixir\n# Basic types\nXDR.Int                  # Section 4.1\nXDR.UInt                 # Section 4.2\nXDR.Bool                 # Section 4.4\nXDR.HyperInt             # Section 4.5\nXDR.HyperUInt            # Section 4.5\nXDR.Float                # Section 4.6\nXDR.DoubleFloat          # Section 4.7\nXDR.Void                 # Section 4.16\n\n# Complex types\nXDR.Enum                 # Section 4.3\nXDR.FixedOpaque          # Section 4.9\nXDR.VariableOpaque       # Section 4.10\nXDR.String               # Section 4.11\nXDR.FixedArray           # Section 4.12\nXDR.VariableArray        # Section 4.13\nXDR.Struct               # Section 4.14\nXDR.Union                # Section 4.15\nXDR.Optional             # Section 4.19\n```\n\nThe following types were not implemented:\n```elixir\nXDR.QuadFloat            # Section 4.8, not supported for 128-byte size.\nXDR.Const                # Section 4.17, can be replaced with elixir constants.\nXDR.Typedef              # Section 4.18, may be implemented with elixir modules. More info bellow in this guide.\n```\n\n## Better without macros\n\n`It is an Open Source project, not a code that only I understand.`\n\nMacros are harder to write than ordinary Elixir functions, implementing them increases the code complexity, which is not good, especially if you plan to build an Open Source code that is easy to understand for everyone. We decided to go without macros, we want to let everyone expand or implement their own XDR types with a clear model based on Elixir functions.\n\n## How to implement an XDR type?\n**Behaviour is the key**. When implementing a new XDR type, follow this [Behaviour's Declaration](https://github.com/kommitters/elixir_xdr/blob/master/lib/xdr/declaration.ex).\n\n### For Encoding\nWe use the function `encode_xdr/2` or the bang version `encode_xdr!/2` to encode any XDR type to its XDR binary format.\n\n### For Decoding\nWe use the function `decode_xdr/2` or the bang version `decode_xdr!/2` to decode any XDR type from an XDR binary format.\n\nIn most XDR types, we must pass the `type specification`, it is a struct (or map) with the XDR type attributes that is expected to decode.\n\n```elixir\niex(1)\u003e enum_spec = XDR.Enum.new([false: 0, true: 1], nil) # preferred.\n%XDR.Enum{declarations: [false: 0, true: 1], identifier: nil}\niex(2)\u003e XDR.Enum.decode_xdr(\u003c\u003c0, 0, 0, 1\u003e\u003e, enum_spec)\n\niex(1)\u003e enum_spec = %{declarations: [false: 0, true: 1]}\niex(2)\u003e XDR.Enum.decode_xdr!(\u003c\u003c0, 0, 0, 0\u003e\u003e, enum_spec)\n{%XDR.Enum{declarations: [false: 0, true: 1], identifier: false}, \u003c\u003c\u003e\u003e}\n```\n\nFor all XDR types, encoded binaries may overflow the byte(s) size, that is why the returning value for decoding functions is set to be a tuple. The first element holds the XDR type decoded and the second element holds the remaining binary after decoding.\n\n```elixir\niex(1)\u003e {decoded_part, remaining_part} = XDR.Int.decode_xdr!(\u003c\u003c127, 255, 255, 255, 5\u003e\u003e)\n{{%XDR.Int{datum: 2147483647}, \u003c\u003c5\u003e\u003e}}\n\n# decoded_part = %XDR.Int{datum: 2147483647}\n# remaining_part = \u003c\u003c5\u003e\u003e\n```\n\n## Basic usage examples\nAs mentioned before, all the XDR types follow the same [Behaviour's Declaration](https://github.com/kommitters/elixir_xdr/blob/master/lib/xdr/declaration.ex)\n\n### XDR.Int - Integer\nAn XDR signed integer is a 32-bit datum that encodes an integer in the range `[-2_147_483_648, 2_147_483_647]`.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.Int.new(1234) |\u003e XDR.Int.encode_xdr()\n{:ok, \u003c\u003c0, 0, 4, 210\u003e\u003e}\n\niex(1)\u003e XDR.Int.new(1234) |\u003e XDR.Int.encode_xdr!()\n\u003c\u003c0, 0, 4, 210\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.Int.decode_xdr(\u003c\u003c0, 0, 4, 210\u003e\u003e)\n{:ok, {%XDR.Int{datum: 1234}, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.Int.decode_xdr!(\u003c\u003c0, 0, 4, 210\u003e\u003e)\n{%XDR.Int{datum: 1234}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/integer.html).\n\n### XDR.UInt - Unsigned Integer\nAn XDR unsigned integer is a 32-bit datum that encodes a non-negative integer in the range `[0, 4_294_967_295]`.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.UInt.new(564) |\u003e XDR.UInt.encode_xdr()\n{:ok, \u003c\u003c0, 0, 2, 52\u003e\u003e}\n\niex(1)\u003e XDR.UInt.new(564) |\u003e XDR.UInt.encode_xdr!()\n\u003c\u003c0, 0, 2, 52\u003e\u003e\n\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.UInt.decode_xdr(\u003c\u003c0, 0, 2, 52\u003e\u003e)\n{:ok, {%XDR.UInt{datum: 564}, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.UInt.decode_xdr!(\u003c\u003c0, 0, 2, 52\u003e\u003e)\n{%XDR.UInt{datum: 564}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/unsigned_integer.html).\n\n### XDR.Enum - Enumeration\nRepresents subsets of integers.\nThe Enumeration's declarations are a keyword list of integers (E.g. `[false: 0, true: 1]`).\n\nEncoding:\n```elixir\niex(1)\u003e XDR.Enum.new([false: 0, true: 1], :false) |\u003e XDR.Enum.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 0\u003e\u003e}\n\niex(1)\u003e XDR.Enum.new([false: 0, true: 1], :true) |\u003e XDR.Enum.encode_xdr!()\n\u003c\u003c0, 0, 0, 1\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e enum_spec = XDR.Enum.new([false: 0, true: 1], nil)\niex(2)\u003e XDR.Enum.decode_xdr(\u003c\u003c0, 0, 0, 1\u003e\u003e, enum_spec)\n{:ok, {%XDR.Enum{declarations: [false: 0, true: 1], identifier: true}, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.Enum.decode_xdr!(\u003c\u003c0, 0, 0, 0\u003e\u003e, %{declarations: [false: 0, true: 1]})\n{%XDR.Enum{declarations: [false: 0, true: 1], identifier: false}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/enumeration.html).\n\n### XDR.Bool - Boolean\nBoolean is an Enumeration implementation that allows us to create boolean types. An XDR Boolean type is an Enumeration with the keyword list `[false: 0, true: 1]` as declarations.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.Bool.new(true) |\u003e XDR.Bool.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 0\u003e\u003e}\n\niex(1)\u003e XDR.Bool.new(true) |\u003e XDR.Bool.encode_xdr!()\n\u003c\u003c0, 0, 0, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.Bool.decode_xdr(\u003c\u003c0, 0, 0, 1\u003e\u003e)\n{:ok, {%XDR.Bool{declarations: [false: 0, true: 1], identifier: true}, \"\"}}\n\niex(1)\u003e XDR.Bool.decode_xdr!(\u003c\u003c0, 0, 0, 1\u003e\u003e)\n{%XDR.Bool{declarations: [false: 0, true: 1], identifier: true}, \"\"}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/boolean.html).\n\n### XDR.HyperInt - Hyper Integer\nIt is an extension of the Integer type defined above. Represents a 64-bit (8-byte) integer with values in a range of `[-9_223_372_036_854_775_808, 9_223_372_036_854_775_807]`.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.HyperInt.new(9_223_372_036_854_775_807) |\u003e XDR.HyperInt.encode_xdr()\n{:ok, \u003c\u003c127, 255, 255, 255, 255, 255, 255, 255\u003e\u003e}\n\niex(1)\u003e XDR.HyperInt.new(258963) |\u003e XDR.HyperInt.encode_xdr!()\n\u003c\u003c0, 0, 0, 0, 0, 3, 243, 147\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.HyperInt.decode_xdr(\u003c\u003c0, 0, 0, 0, 0, 3, 243, 147\u003e\u003e)\n{:ok, {%XDR.HyperInt{datum: 258963}, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.HyperInt.decode_xdr!(\u003c\u003c127, 255, 255, 255, 255, 255, 255, 255\u003e\u003e)\n{%XDR.HyperInt{datum: 9223372036854775807}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/hyper_integer.html).\n\n### XDR.HyperUInt - Unsigned Hyper Integer\nIt is an extension of the Unsigned Integer type defined above. Represents a 64-bit (8-byte) unsigned integer with values in a range of `[0, 18_446_744_073_709_551_615]`.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.HyperUInt.new(258963) |\u003e XDR.HyperUInt.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 0, 0, 3, 243, 147\u003e\u003e}\n\niex(1)\u003e XDR.HyperUInt.new(18_446_744_073_709_551_615) |\u003e XDR.HyperUInt.encode_xdr!()\n\u003c\u003c255, 255, 255, 255, 255, 255, 255, 255\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.HyperUInt.decode_xdr(\u003c\u003c255, 255, 255, 255, 255, 255, 255, 255\u003e\u003e)\n{:ok, {%XDR.HyperUInt{datum: 18446744073709551615}, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.HyperUInt.decode_xdr!(\u003c\u003c0, 0, 0, 0, 0, 3, 243, 147\u003e\u003e)\n{%XDR.HyperUInt{datum: 258963}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/unsigned_hyper_integer.html).\n\n### XDR.Float - Floating Point\nRepresents a single-precision float value (32 bits, 4 bytes).\n\nEncoding:\n```elixir\niex(1)\u003e XDR.Float.new(3.46) |\u003e XDR.Float.encode_xdr()\n{:ok, \u003c\u003c64, 93, 112, 164\u003e\u003e}\n\niex(1)\u003e XDR.Float.new(-2589) |\u003e XDR.Float.encode_xdr!()\n\u003c\u003c197, 33, 208, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.Float.decode_xdr(\u003c\u003c64, 93, 112, 164\u003e\u003e)\n{:ok, {%XDR.Float{float: 3.4600000381469727}, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.Float.decode_xdr!(\u003c\u003c197, 33, 208, 0\u003e\u003e)\n{%XDR.Float{float: -2589.0}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/floating_point.html).\n\n### XDR.DoubleFloat - Double-Floating Point\nRepresents a Double-precision float value (64 bits, 8 bytes).\n\nEncoding:\n```elixir\niex(1)\u003e XDR.DoubleFloat.new(0.333333333333333314829616256247390992939472198486328125) |\u003e XDR.DoubleFloat.encode_xdr()\n{:ok, \u003c\u003c63, 213, 85, 85, 85, 85, 85, 85\u003e\u003e}\n\niex(1)\u003e XDR.DoubleFloat.new(258963) |\u003e XDR.DoubleFloat.encode_xdr!()\n\u003c\u003c65, 15, 156, 152, 0, 0, 0, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.DoubleFloat.decode_xdr(\u003c\u003c65, 15, 156, 152, 0, 0, 0, 0\u003e\u003e)\n{:ok, {%XDR.DoubleFloat{float: 258963.0}, \"\"}}\n\niex(1)\u003e XDR.DoubleFloat.decode_xdr!(\u003c\u003c64, 11, 174, 20, 122, 225, 71, 174\u003e\u003e)\n{%XDR.DoubleFloat{float: 3.46}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/double_floating_point.html).\n\n### XDR.FixedOpaque - Fixed-Length Opaque\nRepresents a fixed-length uninterpreted data (This data is called \"opaque\") that needs to be passed among machines.\n\nIn the following examples we will use an opaque of 12-bytes length:\n\nEncoding:\n```elixir\niex(1)\u003e XDR.FixedOpaque.new(\u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e, 12) |\u003e XDR.FixedOpaque.encode_xdr()\n{:ok, \u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e}\n\niex(1)\u003e XDR.FixedOpaque.new(\u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e, 12) |\u003e XDR.FixedOpaque.encode_xdr!()\n\u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.FixedOpaque.decode_xdr(\u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e, %{length: 12})\n{:ok, {%XDR.FixedOpaque{length: 12, opaque: \u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e}, \"\"}}\n\niex(1)\u003e opaque_spec = XDR.FixedOpaque.new(nil, 12)\niex(2)\u003e XDR.FixedOpaque.decode_xdr!(\u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e, opaque_spec)\n{%XDR.FixedOpaque{length: 12, opaque: \u003c\u003c72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 0\u003e\u003e}, \"\"}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/fixed_length_opaque.html).\n\n### XDR.VariableOpaque - Variable-Length Opaque\nRepresents a sequence of n (numbered 0 through n-1) arbitrary bytes to be the number n encoded as an unsigned integer. If the maximum length is not specified, it is assumed to be 2\u003csup\u003e32\u003c/sup\u003e - 1.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.VariableOpaque.new(\u003c\u003c1, 2, 3, 4, 5\u003e\u003e, 5) |\u003e XDR.VariableOpaque.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 5, 1, 2, 3, 4, 5, 0, 0, 0\u003e\u003e}\n\niex(1)\u003e XDR.VariableOpaque.new(\u003c\u003c1, 2, 3\u003e\u003e, 3) |\u003e XDR.VariableOpaque.encode_xdr!()\n\u003c\u003c0, 0, 0, 3, 1, 2, 3, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.VariableOpaque.decode_xdr(\u003c\u003c0, 0, 0, 5, 1, 2, 3, 4, 5, 0, 0, 0\u003e\u003e, %{max_size: 5})\n{:ok, {%XDR.VariableOpaque{max_size: 5, opaque: \u003c\u003c1, 2, 3, 4, 5\u003e\u003e}, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.VariableOpaque.decode_xdr!(\u003c\u003c0, 0, 0, 5, 1, 2, 3, 4, 5, 0, 0, 0\u003e\u003e, %{max_size: 5})\n{%XDR.VariableOpaque{max_size: 5, opaque: \u003c\u003c1, 2, 3, 4, 5\u003e\u003e}, \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/variable_length_opaque.html).\n\n### XDR.String - String\nRepresents a string of n (numbered 0 through n-1) ASCII bytes to be the number n encoded as an unsigned integer (as described above), and followed by the n bytes of the string. If the maximum length is not specified, it is assumed to be 2\u003csup\u003e32\u003c/sup\u003e - 1.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.String.new(\"The little prince\") |\u003e XDR.String.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0\u003e\u003e}\n\niex(1)\u003e XDR.String.new(\"The little prince\") |\u003e XDR.String.encode_xdr!()\n\u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.String.decode_xdr(\u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0\u003e\u003e)\n{:ok, {%XDR.String{max_length: 4294967295, string: \"The little prince\"}, \"\"}}\n\niex(1)\u003e XDR.String.decode_xdr!(\u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0\u003e\u003e)\n{%XDR.String{max_length: 4294967295, string: \"The little prince\"}, \"\"}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/string.html).\n\n### XDR.FixedArray - Fixed-Length Array\nRepresents a fixed-length array that contains elements with the same type.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.FixedArray.new([1,2,3], XDR.Int, 3) |\u003e XDR.FixedArray.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3\u003e\u003e}\n\niex(1)\u003e XDR.FixedArray.new([\"The\", \"little\", \"prince\"], XDR.String, 3) |\u003e XDR.FixedArray.encode_xdr!()\n\u003c\u003c0, 0, 0, 3, 84, 104, 101, 0, 0, 0, 0, 6, 108, 105, 116, 116, 108, 101, 0, 0,\n  0, 0, 0, 6, 112, 114, 105, 110, 99, 101, 0, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.FixedArray.decode_xdr(\u003c\u003c0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3\u003e\u003e, %{type: XDR.Int, length: 3})\n{:ok, {[%XDR.Int{datum: 1}, %XDR.Int{datum: 2}, %XDR.Int{datum: 3}], \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.FixedArray.decode_xdr!(\u003c\u003c0, 0, 0, 3, 84, 104, 101, 0, 0, 0, 0, 6, 108, 105, 116, 116, 108,\n 101, 0, 0, 0, 0, 0, 6, 112, 114, 105, 110, 99, 101, 0, 0\u003e\u003e, %{type: XDR.String, length: 3})\n{[\n   %XDR.String{max_length: 4294967295, string: \"The\"},\n   %XDR.String{max_length: 4294967295, string: \"little\"},\n   %XDR.String{max_length: 4294967295, string: \"prince\"}\n ], \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/fixed_length_array.html).\n\n### XDR.VariableArray - Variable-Length Array\nRepresents a variable-length array that contains elements with the same type. If the maximum length is not specified, it is assumed to be 2\u003csup\u003e32\u003c/sup\u003e - 1.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.VariableArray.new([1,2,3], XDR.Int) |\u003e XDR.VariableArray.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3\u003e\u003e}\n\niex(1)\u003e XDR.VariableArray.new([\"The\", \"little\", \"prince\"], XDR.String) |\u003e XDR.VariableArray.encode_xdr!()\n\u003c\u003c0, 0, 0, 3, 0, 0, 0, 3, 84, 104, 101, 0, 0, 0, 0, 6, 108, 105, 116, 116, 108, 101, 0, 0, 0, 0, 0, 6, 112, 114, 105, 110, 99, 101, 0, 0\u003e\u003e\n```\nDecoding:\n```elixir\niex(1)\u003e XDR.VariableArray.decode_xdr(\u003c\u003c0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 3\u003e\u003e,\n...\u003e %{type: XDR.Int, max_length: 3})\n{:ok, {[%XDR.Int{datum: 1}, %XDR.Int{datum: 2}, %XDR.Int{datum: 3}], \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.VariableArray.decode_xdr!(\u003c\u003c0, 0, 0, 3, 0, 0, 0, 3, 84, 104, 101, 0, 0, 0, 0, 6, 108, 105,\n...\u003e 116, 116, 108, 101, 0, 0, 0, 0, 0, 6, 112, 114, 105, 110, 99, 101, 0, 0\u003e\u003e,\n...\u003e %{type: XDR.String, length: 3})\n{[\n   %XDR.String{max_length: 4294967295, string: \"The\"},\n   %XDR.String{max_length: 4294967295, string: \"little\"},\n   %XDR.String{max_length: 4294967295, string: \"prince\"}\n ], \u003c\u003c\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/variable_length_array.html).\n\n### XDR.Struct - Structure\nRepresents a collection of fields, possibly of different data types, typically in fixed and sequence numbers.\n\nEncoding:\n```elixir\niex(1)\u003e name = XDR.String.new(\"The little prince\")\n%XDR.String{max_length: 4294967295, string: \"The little prince\"}\niex(2)\u003e size = XDR.Int.new(298)\n%XDR.Int{datum: 298}\niex(3)\u003e Struct.new([name: name, size: size]) |\u003e Struct.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0, 0, 0, 1, 42\u003e\u003e}\n\niex(1)\u003e name = XDR.String.new(\"The little prince\")\n%XDR.String{max_length: 4294967295, string: \"The little prince\"}\niex(2)\u003e size = XDR.Int.new(298)\n%XDR.Int{datum: 298}\niex(3)\u003e XDR.Struct.new([name: name, size: size]) |\u003e XDR.Struct.encode_xdr!()\n\u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0, 0, 0, 1, 42\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e struct_spec = XDR.Struct.new([name: XDR.String, size: XDR.Int])\niex(2)\u003e XDR.Struct.decode_xdr(\u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0, 0, 0, 1, 42\u003e\u003e, struct_spec)\n{:ok, {%XDR.Struct{components: [name: %XDR.String{max_length: 4294967295, string: \"The little prince\"}, size: %XDR.Int{datum: 298}]}, \"\"}}\n\niex(1)\u003e struct_spec = XDR.Struct.new([name: XDR.String, size: XDR.Int])\niex(2)\u003e XDR.Struct.decode_xdr!(\u003c\u003c0, 0, 0, 17, 84, 104, 101, 32, 108, 105, 116, 116, 108, 101, 32, 112, 114, 105, 110, 99, 101, 0, 0, 0, 0, 0, 1, 42\u003e\u003e, struct_spec)\n{%XDR.Struct{components: [name: %XDR.String{max_length: 4294967295, string: \"The little prince\"}, size: %XDR.Int{datum: 298}]}, \"\"}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/structure.html).\n\n### XDR.Union - Discriminated Union\nA discriminated union is a type composed of a discriminant followed by a type selected from a set of prearranged types according to the value of the discriminant. The component types are called `arms` of the union and are preceded by the value of the discriminant that implies their encoding or decoding.\n\nThe type of discriminant is either `XDR.Int`, `XDR.UInt`, or an `XDR.Enum` type.\n\nThe `arms` can be a keyword list or a map and the value of each arm can be either a struct or a module of any XDR type. You can define a default arm using `:default` as a key (The default arm is optional).\n\nEncoding:\n```elixir\niex(1)\u003e enum = %XDR.Enum{declarations: [case_1: 1, case_2: 2, case_3: 3], identifier: :case_1}\niex(2)\u003e arms = [case_1: %XDR.Int{datum: 123}, case_2: %XDR.Int{datum: 2}, case_3: XDR.Float, default: XDR.String]\niex(3)\u003e enum |\u003e XDR.Union.new(arms) |\u003e XDR.Union.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 1, 0, 0, 0, 123\u003e\u003e}\n```\n\nDecoding:\n```elixir\niex(1)\u003e enum = %XDR.Enum{declarations: [case_1: 1, case_2: 2, case_3: 3]}\niex(2)\u003e arms = [case_1: %XDR.Int{datum: 123}, case_2: %XDR.Int{datum: 2}, case_3: XDR.Float, default: XDR.String]\niex(3)\u003e union = XDR.Union.new(enum, arms)\niex(4)\u003e XDR.Union.decode_xdr(\u003c\u003c0, 0, 0, 1, 0, 0, 0, 123\u003e\u003e, union)\n{:ok, {{:case_1, %XDR.Int{datum: 123}}, \"\"}}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/discriminated_union.html).\n\n### XDR.Void - Void\nRepresents a 0-byte quantity.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.Void.new(nil) |\u003e XDR.Void.encode_xdr()\n{:ok, \u003c\u003c\u003e\u003e}\n\niex(1)\u003e XDR.Void.new() |\u003e XDR.Void.encode_xdr!()\n\u003c\u003c\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e XDR.Void.decode_xdr(\u003c\u003c\u003e\u003e)\n{:ok, {nil, \u003c\u003c\u003e\u003e}}\n\niex(1)\u003e XDR.Void.decode_xdr!(\u003c\u003c72, 101, 108, 108, 111\u003e\u003e)\n{nil, \u003c\u003c72, 101, 108, 108, 111, 0\u003e\u003e}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/void.html).\n\n### XDR.Optional - Optional\nRepresents one kind of union that occurs so frequently that we give it a special syntax of its own for declaring it. An optional-data could be any XDR type of data or `XDR.Void`.\n\nEncoding:\n```elixir\niex(1)\u003e XDR.String.new(\"this is an example.\") |\u003e XDR.Optional.new() |\u003e XDR.Optional.encode_xdr()\n{:ok, \u003c\u003c0, 0, 0, 1, 0, 0, 0, 19, 116, 104, 105, 115, 32, 105, 115, 32, 97, 110, 32, 101, 120, 97, 109, 112, 108, 101, 46, 0\u003e\u003e}\n\niex(1)\u003e XDR.Optional.new(nil) |\u003e XDR.Optional.encode_xdr!()\n\u003c\u003c0, 0, 0, 0\u003e\u003e\n```\n\nDecoding:\n```elixir\niex(1)\u003e optional_spec = XDR.Optional.new(XDR.String)\niex(2)\u003e XDR.Optional.decode_xdr(\u003c\u003c0, 0, 0, 1, 0, 0, 0, 19, 116, 104, 105, 115, 32, 105, 115, 32, 97, 110, 32, 101, 120, 97, 109, 112, 108, 101, 46, 0\u003e\u003e, optional_spec)\n{:ok, {%XDR.Optional{type: %XDR.String{max_length: 4294967295, string: \"this is an example\"}}, \"\"}}\n\niex(1)\u003e optional_spec = XDR.Optional.new(XDR.String)\niex(2)\u003e XDR.Optional.decode_xdr!(\u003c\u003c0, 0, 0, 0\u003e\u003e, optional_spec)\n{nil, \"\"}\n```\n\nMore examples [here](https://hexdocs.pm/elixir_xdr/optional_data.html).\n\n## Development\n* Install any Elixir version above 1.7.\n* Compile dependencies: `mix deps.get`.\n* Run tests: `mix test`.\n\n## Code of conduct\nWe welcome everyone to contribute. Make sure you have read the [CODE_OF_CONDUCT][coc] before.\n\n## Contributing\nFor information on how to contribute, please refer to our [CONTRIBUTING][contributing] guide.\n\n## Changelog\nFeatures and bug fixes are listed in the [CHANGELOG][changelog] file.\n\n## License\nThis library is licensed under an MIT license. See [LICENSE][license] for details.\n\n## Acknowledgements\nMade with 💙 by [kommitters Open Source](https://kommit.co)\n\n[license]: https://github.com/kommitters/elixir_xdr/blob/master/LICENSE.md\n[coc]: https://github.com/kommitters/elixir_xdr/blob/master/CODE_OF_CONDUCT.md\n[changelog]: https://github.com/kommitters/elixir_xdr/blob/master/CHANGELOG.md\n[contributing]: https://github.com/kommitters/elixir_xdr/blob/master/CONTRIBUTING.md\n[hex]: https://hex.pm/packages/elixir_xdr\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkommitters%2Felixir_xdr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkommitters%2Felixir_xdr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkommitters%2Felixir_xdr/lists"}