{"id":19863437,"url":"https://github.com/sandialabs/gulliver","last_synced_at":"2025-05-09T00:09:55.311Z","repository":{"id":52343912,"uuid":"199037834","full_name":"sandialabs/Gulliver","owner":"sandialabs","description":"Gulliver is a C# utility package and library engineered for the manipulation of arbitrary sized byte arrays accounting for appropriate endianness and jagged byte length.","archived":false,"fork":false,"pushed_at":"2025-04-29T16:55:58.000Z","size":321,"stargazers_count":18,"open_issues_count":2,"forks_count":3,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-05-09T00:09:49.657Z","etag":null,"topics":["arcus","big-endian","binary","bitwise","boolean-logic","byte-array","bytearray","bytes","c-sharp","dotnet","endian","endianness","little-endian","math","scr-2405","snl-other"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sandialabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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":"2019-07-26T15:10:54.000Z","updated_at":"2025-04-29T16:53:15.000Z","dependencies_parsed_at":"2023-01-21T22:16:46.860Z","dependency_job_id":"1d30ce29-fc2f-4825-bf4f-642490c97bc6","html_url":"https://github.com/sandialabs/Gulliver","commit_stats":{"total_commits":37,"total_committers":9,"mean_commits":4.111111111111111,"dds":0.7027027027027026,"last_synced_commit":"933a36ed5044fbe008d7b4bb70af4f9ac2502155"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FGulliver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FGulliver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FGulliver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sandialabs%2FGulliver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sandialabs","download_url":"https://codeload.github.com/sandialabs/Gulliver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253166521,"owners_count":21864482,"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":["arcus","big-endian","binary","bitwise","boolean-logic","byte-array","bytearray","bytes","c-sharp","dotnet","endian","endianness","little-endian","math","scr-2405","snl-other"],"created_at":"2024-11-12T15:14:40.411Z","updated_at":"2025-05-09T00:09:55.297Z","avatar_url":"https://github.com/sandialabs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# ![Gulliver](src/Gulliver/icon.png) Gulliver\n\n![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/sandialabs/Gulliver/build.yml?branch=main)\n[![nuget Version](https://img.shields.io/nuget/v/Gulliver)](https://www.nuget.org/packages/Gulliver)\n[![GitHub Release](https://img.shields.io/github/v/release/sandialabs/Gulliver)](https://github.com/sandialabs/Gulliver/releases)\n[![GitHub Tag](https://img.shields.io/github/v/tag/sandialabs/Gulliver)](https://github.com/sandialabs/Gulliver/tags)\n![Targets](https://img.shields.io/badge/.NET%20Standard%202.0%20|%20.NET%208.0%20|%20.NET%209.0-blue?logo=.net)\n[![Apache 2.0 License](https://img.shields.io/github/license/sandialabs/Gulliver?logo=apache)](https://github.com/sandialabs/Gulliver/blob/main/LICENSE)\n\n## About the Project\n\nGulliver is a C# utility package and library engineered for the manipulation of arbitrary sized byte arrays accounting for appropriate endianness and jagged byte length. Functionality includes the as previously unsupported standard set of boolean algebraic operations, bitwise shifting, and unsigned endian aware mathematical addition, subtraction, and comparison. Gulliver exist to free developers from managing byte ordering and operations at the low level as was previously required by the standard C# language distributions.\n\nGulliver was of course named for the titular character in \"**[Gulliver's Travels](https://www.gutenberg.org/ebooks/829)**\", a.k.a. \"**Travels into Several Remote Nations of the World. In Four Parts. By Lemuel Gulliver, First a Surgeon, and then a Captain of Several Ships**\" by Jonathan Swift, a book that the library author has admittedly not yet read but was pulled from the Computer Science zeitgeist referring to the big-endian versus little-endian nature of byte ordering.\n\nGulliver originally came to be for the sake of [Arcus](https://github.com/sandialabs/arcus), a C# library for calculating, parsing, formatting, converting and comparing both IPv4 and IPv6 addresses and subnets. Inherently, by its nature, Arcus needed to do a great deal of byte manipulation. Eventually Gulliver came into a life of its own and it was decided that it should be broken off into its own library.\n\n## Getting Started\n\nGulliver is available via a [NuGet](https://www.nuget.org/packages/Gulliver/).\n\nDocumentation can be found on [Gulliver's Read the Docs site](https://gulliver.readthedocs.io/en/latest/).\n\n### Usage\n\nBit-curious developers will likely gain the most use out of the static `ByteArrayUtils` (multi-part) class. It is filled with a plethora of static helper methods and extension methods that work with byte arrays (`byte[]`) and related types. Here in you will be able to modify and manage arbitrary byte arrays of arbitrary length.\n\nOperations are broken down in several fundamental categories, with appropriate considerations made for the endianness of the byte array when appropriate.\n\n- General byte array operations\n  - Byte array creation and population\n  - Bytes as bit array addressing\n  - Byte array trimming, padding, and appending\n  - MSB length counting\n  - MSB 0 value trimming\n  - Stringification\n- Bitwise byte array operations\n  - AND / OR / XOR / NOT\n  - Bitshifting\n- Unsigned Mathematical Operations\n  - Addition / Subtraction / Increment / Decrement\n  - Comparison\n\nThe `FixedBytes` class brings many of these operations together allowing developers to treat a `byte[]` as a more complex object without the need to explicitly call helper or extension methods.\n\nThe `LittleEndianByteEnumerable` and `BigEndianByteEnumerable` gives access to more cleanly treat little-endian and big-endian byte arrays as enumerables in an expected indexable manner regardless of the underlying endianness ignoring `0x00` valued most significant bytes and managing indexing of the most significant byte at the 0th index.\n\n`ConcurrentBigEndianByteEnumerable` and `ConcurrentLittleEndianByteEnumerable` allows for ease in parallel indexing a pair of byte arrays, that may not be of the same length, in the desired endianness. This comes in particularly useful when running bitwise or mathematical operations.\n\n### Developer Notes\n\n## Built With\n\nThis project was built with the aid of:\n\n- [CSharpier](https://csharpier.com/)\n- [dotnet-outdated](https://github.com/dotnet-outdated/dotnet-outdated)\n- [Husky.Net](https://alirezanet.github.io/Husky.Net/)\n- [Roslynator](https://josefpihrt.github.io/docs/roslynator/)\n- [SonarAnalyzer](https://www.sonarsource.com/products/sonarlint/features/visual-studio/)\n- [StyleCop.Analyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers)\n- [xUnit.net](https://xunit.net/)\n\n### Versioning\n\nThis project uses [Semantic Versioning](https://semver.org/)\n\n### Targeting\n\nThe project targets [.NET Standard 2.0](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0), [.NET 8](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-8), and [.NET 9](https://learn.microsoft.com/en-us/dotnet/core/whats-new/dotnet-9/overview). The test project similarly targets .NET 8, .NET 9, but targets [.NET Framework 4.8](https://dotnet.microsoft.com/en-us/download/dotnet-framework/net48) for the .NET Standard 2.0 tests.\n\n### Commit Hook\n\nThe project itself has a configured pre-commit git hook, via [Husky.Net](https://alirezanet.github.io/Husky.Net/) that automatically lints and formats code via [dotnet format](https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-format) and [csharpier](https://csharpier.com/).\n\n#### Disable husky in CI/CD pipelines\n\nPer the [Husky.Net instructions](https://alirezanet.github.io/Husky.Net/guide/automate.html#disable-husky-in-ci-cd-pipelines)\n\n\u003e You can set the `HUSKY` environment variable to `0` in order to disable husky in CI/CD pipelines.\n\n#### Manual Linting and Formatting\n\nOn occasion a manual run is desired it may be done so via the `src` directory and with the command\n\n```shell\ndotnet format style; dotnet format analyzers; dotnet csharpier format .\n```\n\nThese commands may be called independently, but order may matter.\n\n#### Testing\n\nAfter making changes tests should be run that include all targets\n\n## Acknowledgments\n\nThis project was built by the Production Tools Team at Sandia National Laboratories. Special thanks to all contributors and reviewers who helped shape and improve this library.\n\nIncluding, but not limited to:\n\n- **Robert H. Engelhardt** - _Primary Developer, Source of Ideas Good and Bad_ - [rheone](https://github.com/rheone)\n- **Andrew Steele** - _Code Review and Suggestions_ - [ahsteele](https://github.com/ahsteele)\n- **Nick Bachicha** - _Git Wrangler and DevOps Extraordinaire_ - [nicksterx](https://github.com/nicksterx)\n\n## Copyright\n\n\u003e Copyright 2025 National Technology \u0026 Engineering Solutions of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the U.S. Government retains certain rights in this software.\n\n## License\n\n\u003e Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\u003e\n\u003e http://www.apache.org/licenses/LICENSE-2.0\n\u003e\n\u003e Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Fgulliver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsandialabs%2Fgulliver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsandialabs%2Fgulliver/lists"}