{"id":16319714,"url":"https://github.com/inmcm/xoodoo","last_synced_at":"2025-06-18T11:38:53.148Z","repository":{"id":39908232,"uuid":"287848632","full_name":"inmcm/xoodoo","owner":"inmcm","description":"Golang Implementation of Xoodoo Permutation and Xoofff/Xoodyak Crypto Suites","archived":false,"fork":false,"pushed_at":"2023-01-07T02:42:57.000Z","size":171,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-07T09:51:45.853Z","etag":null,"topics":["authenticated-encryption","crypto","cryptography","go","hashing","lightweight-cryptography","nist","xoodoo","xoodyak"],"latest_commit_sha":null,"homepage":"","language":"Go","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/inmcm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-16T00:46:53.000Z","updated_at":"2024-05-30T11:15:47.000Z","dependencies_parsed_at":"2023-02-06T10:47:06.835Z","dependency_job_id":null,"html_url":"https://github.com/inmcm/xoodoo","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/inmcm/xoodoo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmcm%2Fxoodoo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmcm%2Fxoodoo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmcm%2Fxoodoo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmcm%2Fxoodoo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inmcm","download_url":"https://codeload.github.com/inmcm/xoodoo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inmcm%2Fxoodoo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260546108,"owners_count":23025874,"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","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":["authenticated-encryption","crypto","cryptography","go","hashing","lightweight-cryptography","nist","xoodoo","xoodyak"],"created_at":"2024-10-10T22:28:00.053Z","updated_at":"2025-06-18T11:38:48.129Z","avatar_url":"https://github.com/inmcm.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Reference](https://pkg.go.dev/badge/github.com/inmcm/xoodoo.svg)](https://pkg.go.dev/github.com/inmcm/xoodoo)\n[![Go Report Card](https://goreportcard.com/badge/github.com/inmcm/xoodoo)](https://goreportcard.com/report/github.com/inmcm/xoodoo)\n\n# Xoodoo/Xoodyak\nA pure Go implementation of the [Xoodyak](https://keccak.team/xoodyak.html) cryptographic scheme utilizing the [Xoodoo](https://keccak.team/xoodoo.html) permutation function. The Xoodyak implementation supports all specified Cyclist mode functions described in the [specification](https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-spec-doc/xoodyak-spec-final.pdf). \n\nIn addition, higher level primitives are provided to support the hashing and authenticated encryption modes described in [NIST's LightWeight Cryptography (LWC)](https://csrc.nist.gov/Projects/lightweight-cryptography/finalists) competition. Go standard library interfaces are also supported where applicable. Test vectors are taken from or otherwise generated from the [reference C code](https://csrc.nist.gov/CSRC/media/Projects/lightweight-cryptography/documents/finalist-round/updated-submissions/xoodyak.zip) provided to NIST as part of the\nLWC competition.\n\n## Installation\nInstall like any Go package:\n```bash\ngo get -u github.com/inmcm/xoodoo@latest\n```\nfor versions of Go before `1.16` use:\n```bash\nGO111MODULE=on go get -u github.com/inmcm/xoodoo\n```\n\n## Command-line Tools\nFor examples using this package to process files using the Xoodyak LWC primitives see [xoodyak-tools](https://github.com/inmcm/xoodyak-tools) for cross-platform, command-line tools.\n\n## Quickstart\nIf you need just the LWC defined Xoodyak hashing or AEAD operating modes, examples are given below. For other uses of this package, please consult the documentation.\n\n### Hashing\nXoodyak provides a default hashing function that will output a 256-bit digest provided an arbitrary number of input bytes.\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/inmcm/xoodoo/xoodyak\"\n)\n\nfunc main() {\n\tmyMsg := []byte(\"hello xoodoo\")\n\tmyHash := xoodyak.HashXoodyak(myMsg)\n\tfmt.Printf(\"Msg:'%s'\\nHash:%x\\n\", myMsg, myHash)\n}\n```\n```sh\n% go run main.go\nMsg:hello xoodoo\nHash:5c9a95363d79b2157cbdfff49dddaf1f20562dc64644f2d28211478537e6b29a\n```\nFor more complicated hashing tasks that require multi-part input or streaming bytes via [io.Readers](https://pkg.go.dev/io#Reader), the standard library [hash.Hash](https://pkg.go.dev/hash#Hash) interface is also supported.\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\n\t\"github.com/inmcm/xoodoo/xoodyak\"\n)\n\nfunc main() {\n\tmyMsg := []byte(\"hello xoodoo\")\n\tmsgBuf := bytes.NewBuffer(myMsg)\n\txHash := xoodyak.NewXoodyakHash()\n\tio.Copy(xHash, msgBuf)\n\tmyHash := xHash.Sum(nil)\n\tfmt.Printf(\"Msg:'%s'\\nHash:%x\\n\", myMsg, myHash)\n}\n```\n```sh\n% go run main.go\nMsg:'hello xoodoo'\nHash:5c9a95363d79b2157cbdfff49dddaf1f20562dc64644f2d28211478537e6b29a\n```\n### Authenticated Encryption\nXoodyak provides an Authenticated Encryption with Associated Data (AEAD) mode that requires a 128-bit key and 128-bit nonce to encrypt a message of arbitrary length. An optional number of associated data bytes may also be provided. A 128-bit authentication tag is also generated at encrypt time that can be used during decryption to verify the integrity of the resulting plaintext.\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/inmcm/xoodoo/xoodyak\"\n)\n\nfunc main() {\n\tmyMsg := []byte(\"hello xoodoo\")\n\t// Normally, this is randomly generated and kept secret\n\tmyKey := []byte{\n\t\t0x0F, 0x0E, 0x0D, 0x0C,\n\t\t0x0B, 0x0A, 0x09, 0x08,\n\t\t0x07, 0x06, 0x05, 0x04,\n\t\t0x03, 0x02, 0x01, 0x00,\n\t}\n\t// Normally, this is randomly generated and never repeated per key\n\tmyNonce := []byte{\n\t\t0xF0, 0xE1, 0xD2, 0xC3,\n\t\t0xB4, 0xA5, 0x96, 0x87,\n\t\t0x78, 0x69, 0x5A, 0x4B,\n\t\t0x3C, 0x2D, 0x1E, 0x0F,\n\t}\n\t// Any sort of non-secret information about the plaintext or context of encryption\n\tmyAD := []byte(\"33°59’39.51″N, 7°50’33.69″E\")\n\tmyCt, myTag, _ := xoodyak.CryptoEncryptAEAD(myMsg, myKey, myNonce, myAD)\n\tmyPt, valid, _ := xoodyak.CryptoDecryptAEAD(myCt, myKey, myNonce, myAD, myTag)\n\tvar output strings.Builder\n\tfmt.Fprintf(\u0026output, \"Msg:'%s'\\n\", myMsg)\n\tfmt.Fprintf(\u0026output, \"Key:%x\\n\", myKey)\n\tfmt.Fprintf(\u0026output, \"Nonce:%x\\n\", myNonce)\n\tfmt.Fprintf(\u0026output, \"Metadata:%x\\n\", myAD)\n\tfmt.Fprintf(\u0026output, \"Ciphertext:%x\\n\", myCt)\n\tfmt.Fprintf(\u0026output, \"AuthTag:%x\\n\", myTag)\n\tfmt.Fprintf(\u0026output, \"DecryptOK:%t\\n\", valid)\n\tfmt.Fprintf(\u0026output, \"Plaintext:'%s'\", myPt)\n\tfmt.Println(output.String())\n}\n```\n```sh\n% go run main.go\nMsg:'hello xoodoo'\nKey:0f0e0d0c0b0a09080706050403020100\nNonce:f0e1d2c3b4a5968778695a4b3c2d1e0f\nMetadata:3333c2b03539e2809933392e3531e280b34e2c2037c2b03530e2809933332e3639e280b345\nCiphertext:fffc82f88d8bb2ba4f38b85d\nAuthTag:6ef42d19830b3f0ecd784be7f4d10f46\nDecryptOK:true\nPlaintext:'hello xoodoo'\n```\nFor easier integration with existing AEAD code, the standard library [cipher.AEAD](https://pkg.go.dev/crypto/cipher#AEAD) interface is also supported:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"strings\"\n\n\t\"github.com/inmcm/xoodoo/xoodyak\"\n)\n\nfunc main() {\n\tmyMsg := []byte(\"hello xoodoo\")\n\t// Normally, this is randomly generated and kept secret\n\tmyKey := []byte{\n\t\t0x0F, 0x0E, 0x0D, 0x0C,\n\t\t0x0B, 0x0A, 0x09, 0x08,\n\t\t0x07, 0x06, 0x05, 0x04,\n\t\t0x03, 0x02, 0x01, 0x00,\n\t}\n\t// Normally, this is randomly generated and never repeated per key\n\tmyNonce := []byte{\n\t\t0xF0, 0xE1, 0xD2, 0xC3,\n\t\t0xB4, 0xA5, 0x96, 0x87,\n\t\t0x78, 0x69, 0x5A, 0x4B,\n\t\t0x3C, 0x2D, 0x1E, 0x0F,\n\t}\n\t// Any sort of non-secret data\n\tmyAD := []byte(\"33°59’39.51″N, 7°50’33.69″E\")\n\tmyXkAEAD, _ := xoodyak.NewXoodyakAEAD(myKey)\n\n\tmyAuthCt := myXkAEAD.Seal(nil, myNonce, myMsg, myAD)\n\tmyPt, err := myXkAEAD.Open(nil, myNonce, myAuthCt, myAD)\n\t// error is returned on decrypt authentication failure\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tvar output strings.Builder\n\tfmt.Fprintf(\u0026output, \"Msg:'%s'\\n\", myMsg)\n\tfmt.Fprintf(\u0026output, \"Key:%x\\n\", myKey)\n\tfmt.Fprintf(\u0026output, \"Nonce:%x\\n\", myNonce)\n\tfmt.Fprintf(\u0026output, \"Metadata:%x\\n\", myAD)\n\tfmt.Fprintf(\u0026output, \"Authenticated Ciphertext:%x\\n\", myAuthCt)\n\tfmt.Fprintf(\u0026output, \"Plaintext:'%s'\", myPt)\n\tfmt.Println(output.String())\n}\n```\n```sh\n% go run main.go\nMsg:'hello xoodoo'\nKey:0f0e0d0c0b0a09080706050403020100\nNonce:f0e1d2c3b4a5968778695a4b3c2d1e0f\nMetadata:3333c2b03539e2809933392e3531e280b34e2c2037c2b03530e2809933332e3639e280b345\nAuthenticated Ciphertext:fffc82f88d8bb2ba4f38b85d6ef42d19830b3f0ecd784be7f4d10f46\nPlaintext:'hello xoodoo'\n```\n\nFor applications that are better suited to streaming bytes via an [io.Reader](https://pkg.go.dev/io#Reader) or [io.Writer](https://pkg.go.dev/io#Writer), the DecryptStream and EncryptStream types are available. These types wrap an existing Writer or Reader to transparently encrypt or decrypt bytes respectively.\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\t\"io\"\n\t\"strings\"\n\n\t\"github.com/inmcm/xoodoo/xoodyak\"\n)\n\nfunc main() {\n\tmyMsg := []byte(\"hello xoodoo\")\n\t// Normally, this is randomly generated and kept secret\n\tmyKey := []byte{\n\t\t0x0F, 0x0E, 0x0D, 0x0C,\n\t\t0x0B, 0x0A, 0x09, 0x08,\n\t\t0x07, 0x06, 0x05, 0x04,\n\t\t0x03, 0x02, 0x01, 0x00,\n\t}\n\t// Normally, this is randomly generated and never repeated per key\n\tmyNonce := []byte{\n\t\t0xF0, 0xE1, 0xD2, 0xC3,\n\t\t0xB4, 0xA5, 0x96, 0x87,\n\t\t0x78, 0x69, 0x5A, 0x4B,\n\t\t0x3C, 0x2D, 0x1E, 0x0F,\n\t}\n\t// Any sort of non-secret data\n\tmyAD := []byte(\"33°59’39.51″N, 7°50’33.69″E\")\n\n\t// We want to write our encrypted, authenticated message to this buffer\n\tencryptBuf := bytes.NewBuffer(nil)\n\tmyES, _ := xoodyak.NewEncryptStream(encryptBuf, myKey, myNonce, myAD)\n\n\t// Write as many plaintext bytes, as many times, as needed\n\t_, err := myES.Write(myMsg)\n\tif err != nil {\n\t\t// handle any write errors\n\t}\n\t// Close must be called after all plaintext is written in order to finalize the encryption and \n\t// generate the authentication tag\n\tmyES.Close()\n\tif err != nil {\n\t\t// handle any final write errors\n\t}\n\tciphertext := encryptBuf.Bytes()\n\n\t// Now read back the encrypted bytes and decrypt on the fly into another buffer\n\tplainTextBuf := bytes.NewBuffer(nil)\n\tmyDS, _ := xoodyak.NewDecryptStream(encryptBuf, myKey, myNonce, myAD)\n\n\t// Read until EOF is reached\n\tio.Copy(plainTextBuf, myDS)\n\tif err != nil {\n\t\t// handle any read/authentication errors\n\t}\n\n\tvar output strings.Builder\n\tfmt.Fprintf(\u0026output, \"Msg:'%s'\\n\", myMsg)\n\tfmt.Fprintf(\u0026output, \"Key:%x\\n\", myKey)\n\tfmt.Fprintf(\u0026output, \"Nonce:%x\\n\", myNonce)\n\tfmt.Fprintf(\u0026output, \"Metadata:%x\\n\", myAD)\n\tfmt.Fprintf(\u0026output, \"Authenticated Ciphertext:%x\\n\", ciphertext)\n\tfmt.Fprintf(\u0026output, \"Plaintext:'%s'\", string(plainTextBuf.Bytes()))\n\tfmt.Println(output.String())\n}\n```\n```sh\n% go run main.go\nMsg:'hello xoodoo'\nKey:0f0e0d0c0b0a09080706050403020100\nNonce:f0e1d2c3b4a5968778695a4b3c2d1e0f\nMetadata:3333c2b03539e2809933392e3531e280b34e2c2037c2b03530e2809933332e3639e280b345\nAuthenticated Ciphertext:fffc82f88d8bb2ba4f38b85d6ef42d19830b3f0ecd784be7f4d10f46\nPlaintext:'hello xoodoo'\n```\n\n## Benchmarks\nA collection of micro-benchmarks are provided within each sub-package to allow for performance comparisons between systems and other implementations. To run the entire suite:\n```sh\n% go test -bench=. ./...\ngoos: linux\ngoarch: amd64\npkg: github.com/inmcm/xoodoo/xoodoo\ncpu: AMD EPYC 7601 32-Core Processor\nBenchmarkXoodooPermutation \t 5036336\t       247.1 ns/op\nBenchmarkXorStateBytes     \t155647138\t         8.142 ns/op\nBenchmarkUnmarshalBinary   \t162885417\t         7.921 ns/op\nBenchmarkMarshalBinary     \t22321699\t        57.00 ns/op\nPASS\nok  \tgithub.com/inmcm/xoodoo/xoodoo\t6.903s\ngoos: linux\ngoarch: amd64\npkg: github.com/inmcm/xoodoo/xoodyak\ncpu: AMD EPYC 7601 32-Core Processor\nBenchmarkEncryptAEAD        \t   55347\t     19244 ns/op\nBenchmarkDecryptAEAD        \t   66106\t     19082 ns/op\nBenchmarkHash               \t   71767\t     16448 ns/op\nBenchmarkCryptoHash         \t   76081\t     17217 ns/op\nBenchmarkHashInterface      \t   72882\t     16869 ns/op\nBenchmarkMAC                \t  172496\t      7211 ns/op\nBenchmarkHashInterfaceMAC   \t  193495\t      6746 ns/op\nBenchmarkXoodyakCyclistDown \t81201373\t        15.11 ns/op\nBenchmarkXoodyakCyclistUp   \t 4199320\t       276.5 ns/op\nPASS\nok  \tgithub.com/inmcm/xoodoo/xoodyak\t13.555s\n```\n\n## Caveats\nWhile security was top of mind during development, this implementation has not been fully audited for timing attacks, side channel attacks, or other vulnerabilities. Other bugs not caught by the test cases may be present. Use in a production environment is not encouraged.\n\nIf any of above is of concern, please check out the official [KeccakTools](https://github.com/gvanas/KeccakTools) and [Keccak Code\nPackage](https://github.com/gvanas/KeccakCodePackage)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finmcm%2Fxoodoo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finmcm%2Fxoodoo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finmcm%2Fxoodoo/lists"}