{"id":13832207,"url":"https://github.com/vivint/infectious","last_synced_at":"2025-05-16T04:05:46.317Z","repository":{"id":57480466,"uuid":"76904597","full_name":"vivint/infectious","owner":"vivint","description":"Reed-Solomon forward error correcting library","archived":false,"fork":false,"pushed_at":"2023-10-26T11:51:21.000Z","size":70,"stargazers_count":193,"open_issues_count":2,"forks_count":17,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-04-08T14:09:57.156Z","etag":null,"topics":["berlekamp-welch","erasure-coding","go","golang","reed-solomon","reedsolomon"],"latest_commit_sha":null,"homepage":"http://godoc.org/github.com/vivint/infectious","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vivint.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,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-12-19T23:10:07.000Z","updated_at":"2025-03-22T14:04:59.000Z","dependencies_parsed_at":"2024-01-15T15:46:11.187Z","dependency_job_id":"5f466c04-76c2-4f3e-89a4-e75d6ea02ae5","html_url":"https://github.com/vivint/infectious","commit_stats":{"total_commits":26,"total_committers":9,"mean_commits":2.888888888888889,"dds":0.6153846153846154,"last_synced_commit":"25a574ae18a38b09019ce55e06ce2777e98ae9a0"},"previous_names":["spacemonkeygo/infectious"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivint%2Finfectious","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivint%2Finfectious/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivint%2Finfectious/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vivint%2Finfectious/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vivint","download_url":"https://codeload.github.com/vivint/infectious/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254464895,"owners_count":22075570,"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":["berlekamp-welch","erasure-coding","go","golang","reed-solomon","reedsolomon"],"created_at":"2024-08-04T10:01:55.077Z","updated_at":"2025-05-16T04:05:41.304Z","avatar_url":"https://github.com/vivint.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# infectious\n\n[![GoDoc](https://godoc.org/github.com/vivint/infectious?status.png)](https://godoc.org/github.com/vivint/infectious)\n\nInfectious implements\n[Reed-Solomon forward error correction](https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction).\nIt uses the\n[Berlekamp-Welch error correction algorithm](https://en.wikipedia.org/wiki/Berlekamp%E2%80%93Welch_algorithm)\nto achieve the ability to actually correct errors.\n\n[We wrote a blog post about how this library works!](https://innovation.vivint.com/introduction-to-reed-solomon-bc264d0794f8)\n\n### Example\n\n```golang\nconst (\n\trequired = 8\n\ttotal    = 14\n)\n\n// Create a *FEC, which will require required pieces for reconstruction at\n// minimum, and generate total total pieces.\nf, err := infectious.NewFEC(required, total)\nif err != nil {\n\tpanic(err)\n}\n\n// Prepare to receive the shares of encoded data.\nshares := make([]infectious.Share, total)\noutput := func(s infectious.Share) {\n\t// the memory in s gets reused, so we need to make a deep copy\n\tshares[s.Number] = s.DeepCopy()\n}\n\n// the data to encode must be padded to a multiple of required, hence the\n// underscores.\nerr = f.Encode([]byte(\"hello, world! __\"), output)\nif err != nil {\n\tpanic(err)\n}\n\n// we now have total shares.\nfor _, share := range shares {\n\tfmt.Printf(\"%d: %#v\\n\", share.Number, string(share.Data))\n}\n\n// Let's reconstitute with two pieces missing and one piece corrupted.\nshares = shares[2:]     // drop the first two pieces\nshares[2].Data[1] = '!' // mutate some data\n\nresult, err := f.Decode(nil, shares)\nif err != nil {\n\tpanic(err)\n}\n\n// we have the original data!\nfmt.Printf(\"got: %#v\\n\", string(result))\n```\n\n**Caution:** this package API leans toward providing the user more power and\nperformance at the expense of having some really sharp edges! Read the\ndocumentation about memory lifecycles carefully!\n\nPlease see the docs at http://godoc.org/github.com/vivint/infectious\n\n### Thanks\n\nWe're forever indebted to the giants on whose shoulders we stand. The LICENSE \nhas our full copyright history, but an extra special thanks to Klaus Post for \nmuch of the initial Go code. See his post for more: \nhttp://blog.klauspost.com/blazingly-fast-reed-solomon-coding/\n\n### LICENSE\n\n * Copyright (C) 2016-2017 Vivint, Inc.\n * Copyright (c) 2015 Klaus Post\n * Copyright (c) 2015 Backblaze\n * Copyright (C) 2011 Billy Brumley (billy.brumley@aalto.fi)\n * Copyright (C) 2009-2010 Jack Lloyd (lloyd@randombit.net)\n * Copyright (C) 1996-1998 Luigi Rizzo (luigi@iet.unipi.it)\n\nPortions derived from code by Phil Karn (karn@ka9q.ampr.org),\nRobert Morelos-Zaragoza (robert@spectra.eng.hawaii.edu) and Hari\nThirumoorthy (harit@spectra.eng.hawaii.edu), Aug 1995\n\n**Portions of this project (labeled in each file) are licensed under this\nlicense:**\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n1. Redistributions of source code must retain the above copyright\n   notice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\n   notice, this list of conditions and the following disclaimer in the\n   documentation and/or other materials provided with the\n   distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR\nIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT,\nINDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\nHOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\nSTRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING\nIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n\n**All other portions of this project are licensed under this license:**\n\nThe MIT License (MIT)\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivint%2Finfectious","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvivint%2Finfectious","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvivint%2Finfectious/lists"}